Просмотр исходного кода

ZF-10552
Merged in Zend_Service_Ebay from incubator to trunk, tests, library & docs


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23105 44c647ce-9c0f-0410-b52a-842ac1e357ba

ralph 15 лет назад
Родитель
Сommit
2bcdba77e5
47 измененных файлов с 5144 добавлено и 0 удалено
  1. 42 0
      documentation/manual/en/module_specs/Zend_Service_Ebay.xml
  2. 155 0
      documentation/manual/en/module_specs/Zend_Service_Ebay_Finding.xml
  3. 309 0
      library/Zend/Service/Ebay/Abstract.php
  4. 37 0
      library/Zend/Service/Ebay/Exception.php
  5. 421 0
      library/Zend/Service/Ebay/Finding.php
  6. 142 0
      library/Zend/Service/Ebay/Finding/Abstract.php
  7. 79 0
      library/Zend/Service/Ebay/Finding/Aspect.php
  8. 119 0
      library/Zend/Service/Ebay/Finding/Aspect/Histogram/Container.php
  9. 56 0
      library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value.php
  10. 57 0
      library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php
  11. 57 0
      library/Zend/Service/Ebay/Finding/Aspect/Set.php
  12. 73 0
      library/Zend/Service/Ebay/Finding/Category.php
  13. 77 0
      library/Zend/Service/Ebay/Finding/Category/Histogram.php
  14. 66 0
      library/Zend/Service/Ebay/Finding/Category/Histogram/Container.php
  15. 57 0
      library/Zend/Service/Ebay/Finding/Category/Histogram/Set.php
  16. 166 0
      library/Zend/Service/Ebay/Finding/Error/Data.php
  17. 57 0
      library/Zend/Service/Ebay/Finding/Error/Data/Set.php
  18. 60 0
      library/Zend/Service/Ebay/Finding/Error/Message.php
  19. 37 0
      library/Zend/Service/Ebay/Finding/Exception.php
  20. 221 0
      library/Zend/Service/Ebay/Finding/ListingInfo.php
  21. 115 0
      library/Zend/Service/Ebay/Finding/PaginationOutput.php
  22. 185 0
      library/Zend/Service/Ebay/Finding/Response/Abstract.php
  23. 86 0
      library/Zend/Service/Ebay/Finding/Response/Histograms.php
  24. 258 0
      library/Zend/Service/Ebay/Finding/Response/Items.php
  25. 78 0
      library/Zend/Service/Ebay/Finding/Response/Keywords.php
  26. 432 0
      library/Zend/Service/Ebay/Finding/Search/Item.php
  27. 57 0
      library/Zend/Service/Ebay/Finding/Search/Item/Set.php
  28. 63 0
      library/Zend/Service/Ebay/Finding/Search/Result.php
  29. 144 0
      library/Zend/Service/Ebay/Finding/SellerInfo.php
  30. 140 0
      library/Zend/Service/Ebay/Finding/SellingStatus.php
  31. 128 0
      library/Zend/Service/Ebay/Finding/Set/Abstract.php
  32. 131 0
      library/Zend/Service/Ebay/Finding/ShippingInfo.php
  33. 73 0
      library/Zend/Service/Ebay/Finding/Storefront.php
  34. 13 0
      library/Zend/Tool/Project/Provider/Form.php
  35. 6 0
      tests/TestConfiguration.php.dist
  36. 205 0
      tests/Zend/Service/Ebay/AbstractTest.php
  37. 66 0
      tests/Zend/Service/Ebay/AllTests.php
  38. 72 0
      tests/Zend/Service/Ebay/Finding/AllTests.php
  39. 370 0
      tests/Zend/Service/Ebay/Finding/OfflineTest.php
  40. 189 0
      tests/Zend/Service/Ebay/Finding/OnlineTest.php
  41. 3 0
      tests/Zend/Service/Ebay/Finding/_files/ClientCustom.php
  42. 1 0
      tests/Zend/Service/Ebay/Finding/_files/error.xml
  43. 0 0
      tests/Zend/Service/Ebay/Finding/_files/find-items-advanced.xml
  44. 1 0
      tests/Zend/Service/Ebay/Finding/_files/get-search-keywords-recomendation.xml
  45. 0 0
      tests/Zend/Service/Ebay/Finding/_files/histogram-aspect.xml
  46. 1 0
      tests/Zend/Service/Ebay/Finding/_files/histogram-category.xml
  47. 39 0
      tests/Zend/Service/Ebay/_files/Concrete.php

+ 42 - 0
documentation/manual/en/module_specs/Zend_Service_Ebay.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.service.ebay">
+    <title>Zend_Service_Ebay</title>
+
+    <sect2 id="zend.service.ebay.introduction">
+        <title>Introduction</title>
+
+        <para>
+            <classname>Zend_Service_Ebay</classname> is a simple group of
+            <acronym>API</acronym>s for using eBay web services.
+        </para>
+
+        <para>
+            <classname>Zend_Service_Ebay</classname> implements the
+            <ulink url="http://developer.ebay.com/support/docs/">eBay APIs</ulink>:
+            <itemizedlist>
+                <listitem>
+                    <para>
+                        <ulink url="http://developer.ebay.com/DevZone/finding/CallRef/index.html">Finding</ulink>.
+                    </para>
+                </listitem>
+            </itemizedlist>
+        </para>
+
+        <para>
+            In order to use <classname>Zend_Service_Ebay</classname>, you should
+            already have an eBay Application ID. To get a key and for more
+            information, please visit the
+            <ulink url="https://developer.ebay.com/Join/default.aspx">eBay Developers Program</ulink>
+            web site.
+        </para>
+
+        <note>
+            <title>Attention</title>
+            <para>
+                Your Application ID is linked to your eBay identity, so take
+                appropriate measures to keep them private.
+            </para>
+        </note>
+    </sect2>
+</sect1>

+ 155 - 0
documentation/manual/en/module_specs/Zend_Service_Ebay_Finding.xml

@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.service.ebay.finding">
+    <title>Zend_Service_Ebay_Finding</title>
+
+    <sect2 id="zend.service.ebay.finding.introduction">
+        <title>Introduction</title>
+
+        <para>
+            <classname>Zend_Service_Ebay_Finding</classname> provides a client
+            for the <ulink url="http://developer.ebay.com/DevZone/finding/CallRef/index.html">eBay Finding</ulink>.
+            Per eBay website, "The Finding API provides programmatic access to
+            the next generation search capabilities on the eBay platform. It
+            lets you search and browse for items listed on eBay, and provides
+            useful metadata to refine searches and enhance the search experience."
+        </para>
+
+        <para>
+            In order to use <classname>Zend_Service_Ebay_Finding</classname>,
+            you should already have an eBay Application ID. To get a key and for
+            more information, please visit the
+            <ulink url="https://developer.ebay.com/Join/default.aspx">eBay Developers Program</ulink>
+            web site.
+        </para>
+    </sect2>
+
+    <sect2 id="zend.service.ebay.finding.factoring">
+        <title>Create a client object</title>
+
+        <para>
+            Instantiate a <classname>Zend_Service_Ebay_Finding</classname> object,
+            passing it your private keys:
+        </para>
+        <example id="zend.service.ebay.finding.factoring.sample-1">
+            <title>Creating an instance of the eBay Finding service</title>
+            <programlisting language="php"><![CDATA[
+$finding = new Zend_Service_Ebay_Finding('my-app-id');
+]]></programlisting>
+        </example>
+
+        <para>
+            Instantiate a <classname>Zend_Service_Ebay_Finding</classname> object,
+            passing it your private keys and setting options:
+        </para>
+        <example id="zend.service.ebay.finding.factoring.sample-2">
+            <title>Creating an instance of the eBay Finding service</title>
+            <programlisting language="php"><![CDATA[
+$options = array(Zend_Service_Ebay_Abstract::OPTION_APP_ID    => 'my-app-id',
+                 Zend_Service_Ebay_Abstract::OPTION_GLOBAL_ID => 'EBAY-GB');
+$finding = new Zend_Service_Ebay_Finding($options);
+]]></programlisting>
+        </example>
+    </sect2>
+
+    <sect2 id="zend.service.ebay.finding.items">
+        <title>Finding items</title>
+
+        <para>
+            There are five available methods to search items:
+            <itemizedlist>
+                <listitem>
+                    <para>findItemsByKeywords($keywords)</para>
+                </listitem>
+                <listitem>
+                    <para>findItemsByProduct($productId)</para>
+                </listitem>
+                <listitem>
+                    <para>findItemsByCategory($categoryId)</para>
+                </listitem>
+                <listitem>
+                    <para>findItemsAdvanced($keywords)</para>
+                </listitem>
+                <listitem>
+                    <para>findItemsInEbayStores($storeName)</para>
+                </listitem>
+            </itemizedlist>
+        </para>
+
+        <example id="zend.service.ebay.finding.items.sample">
+            <title>Many ways to find items</title>
+            <programlisting language="php"><![CDATA[
+$finding  = new Zend_Service_Ebay_Finding('my-app-id');
+$response = $finding->findItemsByKeywords('zend framework book');
+foreach ($response->searchResult->item as $item) {
+    $item->title;
+    $item->listingInfo->buyItNowPrice; 
+    $item->listingInfo->viewItemURL;
+
+    // inner call, find for items of same current product
+    // like $finding->findItemsByProduct($item->productId, $item->productId_type)
+    $response2 = $item->findItemsByProduct($finding);
+
+    // inner call, find for items of same store
+    // like $finding->findItemsInEbayStores($item->storeInfo->storeName)
+    $response3 = $item->storeInfo->findItems($finding); 
+}
+]]></programlisting>
+        </example>
+    </sect2>
+
+    <sect2 id="zend.service.ebay.finding.keywords-recomendation">
+        <title>Keywords Recommendation</title>
+
+        <para>
+            This operation checks specified keywords and returns correctly
+            spelled keywords for best search results.
+        </para>
+
+        <example id="zend.service.ebay.finding.keywords.sample">
+            <title>Searching keywords recomendation</title>
+            <programlisting language="php"><![CDATA[
+// searching keywords
+$finding = new Zend_Service_Ebay_Finding('my-app-id'); 
+$result  = $finding->getSearchKeywordsRecommendation('zend'); 
+echo 'Did you mean ' . $result->keyword . '?'; 
+
+// inner call 
+// like $finding->findItemsByKeywords($result->keyword) 
+$result2 = $result->findItems($finding); 
+]]></programlisting>
+        </example>
+    </sect2>
+
+    <sect2 id="zend.service.ebay.finding.histogram">
+        <title>Histograms</title>
+
+        <para>
+            Per eBay website, this operation "category and/or aspect histogram
+            information for the eBay category ID you specify. Histograms are
+            item counts for the associated category or aspect value. Input
+            category ID numbers in the request using the categoryId field".
+        </para>
+
+        <example id="zend.service.ebay.finding.histogram.sample">
+            <title>Fetching histogram</title>
+            <programlisting language="php"><![CDATA[
+$finding = new Zend_Service_Ebay_Finding('my-app-id'); 
+$result  = $finding->getHistograms($categoryId); 
+ 
+foreach ($result->categoryHistogramContainer->categoryHistogram as $category) { 
+    $category->categoryId; 
+    $category->categoryName; 
+ 
+    // inner call 
+    // like $finding->findItemsByCategory($category->categoryId); 
+    $result2 = $category->findItems($finding); 
+} 
+]]></programlisting>
+        </example>
+    </sect2>
+
+</sect1>
+<!--
+vim:se ts=4 sw=4 et:
+-->

+ 309 - 0
library/Zend/Service/Ebay/Abstract.php

@@ -0,0 +1,309 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Abstract.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Service_Ebay_Abstract
+{
+    const OPTION_APP_ID    = 'app_id';
+    const OPTION_GLOBAL_ID = 'global_id';
+
+    /**
+     * @var array
+     */
+    protected $_options = array();
+
+    /**
+     * @var mixed
+     */
+    protected $_client;
+
+    /**
+     * @param  Zend_Config|array $options
+     * @return void
+     */
+    public function __construct($options = null)
+    {
+        $options = self::optionsToArray($options);
+        $this->setOption($options);
+    }
+
+    /**
+     * @param  string|Zend_Config|array $name
+     * @param  mixed                    $value
+     * @return Zend_Service_Ebay_Abstract Provides a fluent interface
+     */
+    public function setOption($name, $value = null)
+    {
+        if ($name instanceof Zend_Config) {
+            $name = $name->toArray();
+        }
+        if (is_array($name)) {
+            $this->_options = $name + $this->_options;
+        } else {
+            $this->_options[$name] = $value;
+        }
+        return $this;
+    }
+
+    /**
+     * @param  string $name
+     * @return mixed
+     */
+    public function getOption($name = null)
+    {
+        if (null === $name) {
+            return $this->_options;
+        }
+        if ($this->hasOption($name)) {
+            return $this->_options[$name];
+        }
+        return null;
+    }
+
+    /**
+     * @param string $name
+     * @return boolean
+     */
+    public function hasOption($name)
+    {
+        return array_key_exists($name, $this->_options);
+    }
+
+    /**
+     * @param  mixed $client
+     * @return Zend_Service_Ebay_Abstract Provides a fluent interface
+     */
+    abstract public function setClient($client);
+
+    /**
+     * @return mixed
+     */
+    abstract public function getClient();
+
+    /**
+     * @param  Zend_Config|array $options
+     * @throws Zend_Service_Ebay_Finding_Exception When $options is not an array neither a Zend_Config object
+     * @return array
+     */
+    public static function optionsToArray($options)
+    {
+        if (null === $options) {
+            $options = array();
+        } else if ($options instanceof Zend_Config) {
+            $options = $options->toArray();
+        }
+
+        if (!is_array($options)) {
+            /**
+             * @see Zend_Service_Ebay_Exception
+             */
+            require_once 'Zend/Service/Ebay/Exception.php';
+            throw new Zend_Service_Ebay_Exception('Invalid options provided.');
+        }
+
+        return $options;
+    }
+
+    /**
+     * Implements Name-value Syntax translator.
+     *
+     * Example:
+     *
+     * array(
+     *     'paginationInput' => array(
+     *         'entriesPerPage' => 5,
+     *         'pageNumber'     => 2
+     *     ),
+     *     'itemFilter' => array(
+     *         array(
+     *             'name'       => 'MaxPrice',
+     *             'value'      => 25,
+     *             'paramName'  => 'Currency',
+     *             'paramValue' => 'USD'
+     *         ),
+     *         array(
+     *             'name'  => 'FreeShippingOnly',
+     *             'value' => true
+     *         ),
+     *         array(
+     *             'name'  => 'ListingType',
+     *             'value' => array(
+     *                 'AuctionWithBIN',
+     *                 'FixedPrice',
+     *                 'StoreInventory'
+     *             )
+     *         )
+     *     ),
+     *     'productId' => array(
+     *         ''     => 123,
+     *         'type' => 'UPC'
+     *     )
+     * )
+     *
+     * this above is translated to
+     *
+     * array(
+     *     'paginationInput.entriesPerPage' => '5',
+     *     'paginationInput.pageNumber'     => '2',
+     *     'itemFilter(0).name'             => 'MaxPrice',
+     *     'itemFilter(0).value'            => '25',
+     *     'itemFilter(0).paramName'        => 'Currency',
+     *     'itemFilter(0).paramValue'       => 'USD',
+     *     'itemFilter(1).name'             => 'FreeShippingOnly',
+     *     'itemFilter(1).value'            => '1',
+     *     'itemFilter(2).name'             => 'ListingType',
+     *     'itemFilter(2).value(0)'         => 'AuctionWithBIN',
+     *     'itemFilter(2).value(1)'         => 'FixedPrice',
+     *     'itemFilter(2).value(2)'         => 'StoreInventory',
+     *     'productId'                      => '123',
+     *     'productId.@type'                => 'UPC'
+     * )
+     *
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/Concepts/MakingACall.html#nvsyntax
+     * @return array A simple array of strings
+     */
+    protected function _optionsToNameValueSyntax($options)
+    {
+        $options  = self::optionsToArray($options);
+        ksort($options);
+        $new      = array();
+        $runAgain = false;
+        foreach ($options as $name => $value) {
+            if (is_array($value)) {
+                // parse an array value, check if it is associative
+                $keyRaw    = array_keys($value);
+                $keyNumber = range(0, count($value) - 1);
+                $isAssoc   = count(array_diff($keyRaw, $keyNumber)) > 0;
+                // check for tag representation, like <name att="sometinhg"></value>
+                // empty key refers to text value
+                // when there is a root tag, attributes receive flags
+                $hasAttribute = array_key_exists('', $value);
+                foreach ($value as $subName => $subValue) {
+                    // generate new key name
+                    if ($isAssoc) {
+                        // named keys
+                        $newName = $name;
+                        if ($subName !== '') {
+                            // when $subName is empty means that current value
+                            // is the main value for the main key
+                            $glue     = $hasAttribute ? '.@' : '.';
+                            $newName .= $glue . $subName;
+                        }
+                    } else {
+                        // numeric keys
+                        $newName = $name . '(' . $subName . ')';
+                    }
+                    // save value
+                    if (is_array($subValue)) {
+                        // it is necessary run this again, value is an array
+                        $runAgain = true;
+                    } else {
+                        // parse basic type
+                        $subValue = self::toEbayValue($subValue);
+                    }
+                    $new[$newName] = $subValue;
+                }
+            } else {
+                // parse basic type
+                $new[$name] = self::toEbayValue($value);
+            }
+        }
+        if ($runAgain) {
+            // this happens if any $subValue found is an array
+            $new = $this->_optionsToNameValueSyntax($new);
+        }
+        return $new;
+    }
+
+    /**
+     * Translate native PHP values format to ebay format for request.
+     *
+     * Boolean is translated to "0" or "1", date object generates ISO 8601,
+     * everything else is translated to string.
+     *
+     * @param  mixed $value
+     * @return string
+     */
+    public static function toEbayValue($value)
+    {
+        if (is_bool($value)) {
+            $value = $value ? '1' : '0';
+        } else if ($value instanceof Zend_Date) {
+            $value = $value->getIso();
+        } else if ($value instanceof DateTime) {
+            $value = $value->format(DateTime::ISO8601);
+        } else {
+            $value = (string) $value;
+        }
+        return $value;
+    }
+
+    /**
+     * Translate an ebay value format to native PHP type.
+     *
+     * @param  string $value
+     * @param  string $type
+     * @see    http://developer.ebay.com/DevZone/finding/CallRef/types/simpleTypes.html
+     * @throws Zend_Service_Ebay_Finding_Exception When $type is not valid
+     * @return mixed
+     */
+    public static function toPhpValue($value, $type)
+    {
+        switch ($type) {
+            // cast for: boolean
+            case 'boolean':
+                $value = (string) $value == 'true';
+                break;
+
+            // cast for: Amount, decimal, double, float, MeasureType
+            case 'float':
+                $value = floatval((string) $value);
+                break;
+
+            // cast for: int, long
+            // integer type generates a string value, because 32 bit systems
+            // have an integer range of -2147483648 to 2147483647
+            case 'integer':
+                // break intentionally omitted
+
+            // cast for: anyURI, base64Binary, dateTime, duration, string, token
+            case 'string':
+                $value = (string) $value;
+                break;
+
+            default:
+                /**
+                 * @see Zend_Service_Ebay_Exception
+                 */
+                require_once 'Zend/Service/Ebay/Exception.php';
+                throw new Zend_Service_Ebay_Exception("Invalid type '{$type}'.");
+        }
+        return $value;
+    }
+}

+ 37 - 0
library/Zend/Service/Ebay/Exception.php

@@ -0,0 +1,37 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Exception.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Exception
+ */
+require_once 'Zend/Service/Exception.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Exception
+ */
+class Zend_Service_Ebay_Exception extends Zend_Service_Exception
+{}

+ 421 - 0
library/Zend/Service/Ebay/Finding.php

@@ -0,0 +1,421 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Finding.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Abstract
+ */
+require_once 'Zend/Service/Ebay/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Abstract
+ */
+class Zend_Service_Ebay_Finding extends Zend_Service_Ebay_Abstract
+{
+    const SERVICE_NAME         = 'FindingService';
+    const SERVICE_VERSION      = '1.0.0';
+    const RESPONSE_DATA_FORMAT = 'XML';
+
+    const ENDPOINT_URI  = 'http://svcs.ebay.com';
+    const ENDPOINT_PATH = 'services/search/FindingService/v1';
+
+    const XMLNS_FINDING = 'e';
+    const XMLNS_MS      = 'ms';
+
+    /**
+     * @var array
+     */
+    protected static $_xmlNamespaces = array(
+        self::XMLNS_FINDING => 'http://www.ebay.com/marketplace/search/v1/services',
+        self::XMLNS_MS      => 'http://www.ebay.com/marketplace/services'
+    );
+
+    /**
+     *
+     * @var array
+     */
+    protected $_options = array(
+        self::OPTION_GLOBAL_ID => 'EBAY-US'
+    );
+
+    /**
+     * @return array
+     */
+    public static function getXmlNamespaces()
+    {
+        return self::$_xmlNamespaces;
+    }
+
+    /**
+     * @param  Zend_Config|array|string $options Application Id or array of options
+     * @throws Zend_Service_Ebay_Finding_Exception When application id is missing
+     * @return void
+     */
+    public function __construct($options)
+    {
+        // prepare options
+        if (is_string($options)) {
+            // application id was given
+            $options = array(self::OPTION_APP_ID => $options);
+        } else {
+            // check application id
+            $options = parent::optionsToArray($options);
+            if (!array_key_exists(self::OPTION_APP_ID, $options)) {
+                /**
+                 * @see Zend_Service_Ebay_Finding_Exception
+                 */
+                require_once 'Zend/Service/Ebay/Finding/Exception.php';
+                throw new Zend_Service_Ebay_Finding_Exception(
+                    'Application Id is missing.');
+            }
+        }
+
+        // load options
+        parent::setOption($options);
+    }
+
+    /**
+     * @param  Zend_Rest_Client $client
+     * @return Zend_Service_Ebay_Finding Provides a fluent interface
+     */
+    public function setClient($client)
+    {
+        if (!$client instanceof Zend_Rest_Client) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Exception
+             */
+            require_once 'Zend/Service/Ebay/Finding/Exception.php';
+            throw new Zend_Service_Ebay_Finding_Exception(
+                'Client object must extend Zend_Rest_Client.');
+        }
+        $this->_client = $client;
+
+        return $this;
+    }
+
+    /**
+     * @return Zend_Rest_Client
+     */
+    public function getClient()
+    {
+        if (!$this->_client instanceof Zend_Rest_Client) {
+            /**
+             * @see Zend_Rest_Client
+             */
+            require_once 'Zend/Rest/Client.php';
+            $this->_client = new Zend_Rest_Client();
+        }
+        return $this->_client;
+    }
+
+    /**
+     * Finds items by a keyword query and/or category and allows searching
+     * within item descriptions.
+     *
+     * @param  string            $keywords
+     * @param  boolean           $descriptionSearch
+     * @param  integer           $categoryId
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItemsAdvanced($keywords, $descriptionSearch = true, $categoryId = null, $options = null)
+    {
+        // prepare options
+        $options                      = parent::optionsToArray($options);
+        $options['keywords']          = $keywords;
+        $options['descriptionSearch'] = $descriptionSearch;
+        if (!empty($categoryId)) {
+            $options['categoryId'] = $categoryId;
+        }
+
+        // do request
+        return $this->_findItems($options, 'findItemsAdvanced');
+    }
+
+    /**
+     * Finds items in a specific category. Results can be filtered and sorted.
+     *
+     * @param  integer           $categoryId
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/findItemsByCategory.html
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItemsByCategory($categoryId, $options = null)
+    {
+        // prepare options
+        $options               = parent::optionsToArray($options);
+        $options['categoryId'] = $categoryId;
+
+        // do request
+        return $this->_findItems($options, 'findItemsByCategory');
+    }
+
+    /**
+     * Finds items on eBay based upon a keyword query and returns details for
+     * matching items.
+     *
+     * @param  string            $keywords
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/findItemsByKeywords.html
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItemsByKeywords($keywords, $options = null)
+    {
+        // prepare options
+        $options             = parent::optionsToArray($options);
+        $options['keywords'] = $keywords;
+
+        // do request
+        return $this->_findItems($options, 'findItemsByKeywords');
+    }
+
+    /**
+     * Finds items based upon a product ID, such as an ISBN, UPC, EAN, or ePID.
+     *
+     * @param  integer           $productId
+     * @param  string            $productIdType Default value is ReferenceID
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/findItemsByProduct.html
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItemsByProduct($productId, $productIdType = null, $options = null)
+    {
+        if (null == $productIdType) {
+            $productIdType = 'ReferenceID';
+        }
+
+        // prepare options
+        $options              = parent::optionsToArray($options);
+        $options['productId'] = array(''     => $productId,
+                                      'type' => $productIdType);
+
+        // do request
+        return $this->_findItems($options, 'findItemsByProduct');
+    }
+
+    /**
+     * Finds items in eBay stores. Can search a specific store or can search all
+     * stores with a keyword query.
+     *
+     * @param  string            $storeName
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/findItemsIneBayStores.html
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItemsInEbayStores($storeName, $options = null)
+    {
+        // prepare options
+        $options              = parent::optionsToArray($options);
+        $options['storeName'] = $storeName;
+
+        // do request
+        return $this->_findItems($options, 'findItemsIneBayStores');
+    }
+
+    /**
+     * @param  array  $options
+     * @param  string $operation
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    protected function _findItems(array $options, $operation)
+    {
+        // set default output selector value
+        if (!array_key_exists('outputSelector', $options)) {
+            $options['outputSelector'] = array('AspectHistogram',
+                                               'CategoryHistogram',
+                                               'SellerInfo',
+                                               'StoreInfo');
+        }
+
+        // do request
+        $dom = $this->_request($operation, $options);
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Response_Items
+         */
+        require_once 'Zend/Service/Ebay/Finding/Response/Items.php';
+        $response = new Zend_Service_Ebay_Finding_Response_Items($dom->firstChild);
+        return $response->setOperation($operation)
+                        ->setOption($options);
+    }
+
+    /**
+     * Gets category and/or aspect metadata for the specified category.
+     *
+     * @param  integer           $categoryId
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/getHistograms.html
+     * @return Zend_Service_Ebay_Finding_Response_Histograms
+     */
+    public function getHistograms($categoryId, $options = null)
+    {
+        // prepare options
+        $options               = parent::optionsToArray($options);
+        $options['categoryId'] = $categoryId;
+
+        // do request
+        $operation = 'getHistograms';
+        $dom       = $this->_request($operation, $options);
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Response_Histograms
+         */
+        require_once 'Zend/Service/Ebay/Finding/Response/Histograms.php';
+        $response = new Zend_Service_Ebay_Finding_Response_Histograms($dom->firstChild);
+        return $response->setOperation($operation)
+                        ->setOption($options);
+    }
+
+    /**
+     * Checks specified keywords and returns correctly spelled keywords for best
+     * search results.
+     *
+     * @param  string            $keywords
+     * @param  Zend_Config|array $options
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/getSearchKeywordsRecommendation.html
+     * @return Zend_Service_Ebay_Finding_Response_Keywords
+     */
+    public function getSearchKeywordsRecommendation($keywords, $options = null)
+    {
+        // prepare options
+        $options             = parent::optionsToArray($options);
+        $options['keywords'] = $keywords;
+
+        // do request
+        $operation = 'getSearchKeywordsRecommendation';
+        $dom       = $this->_request($operation, $options);
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Response_Keywords
+         */
+        require_once 'Zend/Service/Ebay/Finding/Response/Keywords.php';
+        $response = new Zend_Service_Ebay_Finding_Response_Keywords($dom->firstChild);
+        return $response->setOperation($operation)
+                        ->setOption($options);
+    }
+
+    /**
+     * @param  string $operation
+     * @param  array  $options
+     * @link   http://developer.ebay.com/DevZone/finding/Concepts/MakingACall.html#StandardURLParameters
+     * @return DOMDocument
+     */
+    protected function _request($operation, array $options = null)
+    {
+        // generate default options
+        // constructor load global-id and application-id values
+        $default = array('OPERATION-NAME'       => $operation,
+                         'SERVICE-NAME'         => self::SERVICE_NAME,
+                         'SERVICE-VERSION'      => self::SERVICE_VERSION,
+                         'GLOBAL-ID'            => $this->getOption(self::OPTION_GLOBAL_ID),
+                         'SECURITY-APPNAME'     => $this->getOption(self::OPTION_APP_ID),
+                         'RESPONSE-DATA-FORMAT' => self::RESPONSE_DATA_FORMAT,
+                         'REST-PAYLOAD'         => '');
+
+        // prepare options to ebay syntax
+        $options = $default + $this->_optionsToNameValueSyntax($options);
+
+        // do request
+        $client = $this->getClient();
+        $client->getHttpClient()->resetParameters();
+        $response = $client->setUri(self::ENDPOINT_URI)
+                           ->restGet(self::ENDPOINT_PATH, $options);
+
+        return $this->_parseResponse($response);
+    }
+
+    /**
+     * Search for error from request.
+     *
+     * If any error is found a DOMDocument is returned, this object contains a
+     * DOMXPath object as "ebayFindingXPath" attribute.
+     *
+     * @param  Zend_Http_Response $response
+     * @link   http://developer.ebay.com/DevZone/finding/CallRef/types/ErrorSeverity.html
+     * @see    Zend_Service_Ebay_Finding_Abstract::_initXPath()
+     * @throws Zend_Service_Ebay_Finding_Exception When any error occurrs during request
+     * @return DOMDocument
+     */
+    protected function _parseResponse(Zend_Http_Response $response)
+    {
+        // error message
+        $message = '';
+
+        // first trying, loading XML
+        $dom = new DOMDocument();
+        if (!@$dom->loadXML($response->getBody())) {
+            $message = 'It was not possible to load XML returned.';
+        }
+
+        // second trying, check request status
+        if ($response->isError()) {
+            $message = $response->getMessage()
+                     . ' (HTTP status code #' . $response->getStatus() . ')';
+        }
+
+        // third trying, search for error message into XML response
+        // only first error that contains severiry=Error is read
+        $xpath = new DOMXPath($dom);
+        foreach (self::$_xmlNamespaces as $alias => $uri) {
+            $xpath->registerNamespace($alias, $uri);
+        }
+        $ns           = self::XMLNS_FINDING;
+        $nsMs         = self::XMLNS_MS;
+        $expression   = "//$nsMs:errorMessage[1]/$ns:error/$ns:severity[.='Error']";
+        $severityNode = $xpath->query($expression)->item(0);
+        if ($severityNode) {
+            $errorNode = $severityNode->parentNode;
+            // ebay message
+            $messageNode = $xpath->query("//$ns:message[1]", $errorNode)->item(0);
+            if ($messageNode) {
+                $message = 'eBay error: ' . $messageNode->nodeValue;
+            } else {
+                $message = 'eBay error: unknown';
+            }
+            // ebay error id
+            $errorIdNode = $xpath->query("//$ns:errorId[1]", $errorNode)->item(0);
+            if ($errorIdNode) {
+                $message .= ' (#' . $errorIdNode->nodeValue . ')';
+            }
+        }
+
+        // throw exception when an error was detected
+        if (strlen($message) > 0) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Exception
+             */
+            require_once 'Zend/Service/Ebay/Finding/Exception.php';
+            throw new Zend_Service_Ebay_Finding_Exception($message);
+        }
+
+        // add xpath to dom document
+        // it allows service_ebay_finding classes use this
+        $dom->ebayFindingXPath = $xpath;
+
+        return $dom;
+    }
+}

+ 142 - 0
library/Zend/Service/Ebay/Finding/Abstract.php

@@ -0,0 +1,142 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Abstract.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Abstract
+ */
+require_once 'Zend/Service/Ebay/Abstract.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding
+ */
+require_once 'Zend/Service/Ebay/Finding.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * @var DOMElement
+     */
+    protected $_dom;
+
+    /**
+     * @var DOMXPath
+     */
+    protected $_xPath;
+
+    /**
+     * @param  DOMElement $dom
+     * @return void
+     */
+    public function __construct(DOMElement $dom)
+    {
+        $this->_dom = $dom;
+        $this->_initXPath();
+        $this->_init();
+    }
+
+    /**
+     * Initialize object.
+     *
+     * Post construct logic, classes must read their members here. Called from
+     * {@link __construct()} as final step of object initialization.
+     *
+     * @return void
+     */
+    protected function _init()
+    {
+    }
+
+    /**
+     * Load DOMXPath for current DOM object.
+     *
+     * @see    Zend_Service_Ebay_Finding::_parseResponse()
+     * @return void
+     */
+    protected function _initXPath()
+    {
+        $document = $this->_dom->ownerDocument;
+        if (!isset($document->ebayFindingXPath)) {
+            $xpath = new DOMXPath($document);
+            foreach (Zend_Service_Ebay_Finding::getXmlNamespaces() as $alias => $uri) {
+                $xpath->registerNamespace($alias, $uri);
+            }
+            $document->ebayFindingXPath = $xpath;
+        }
+        $this->_xPath = $document->ebayFindingXPath;
+    }
+
+    /**
+     * @return DOMElement
+     */
+    public function getDom()
+    {
+        return $this->_dom;
+    }
+
+    /**
+     * @return DOMXPath
+     */
+    public function getXPath()
+    {
+        return $this->_xPath;
+    }
+
+    /**
+     * @param  string $path
+     * @param  string $type
+     * @param  string $array When true means it expects more than one node occurence
+     * @return mixed
+     */
+    protected function _query($path, $type, $array = false)
+    {
+        // find values
+        $values = array();
+        $nodes  = $this->_xPath->query($path, $this->_dom);
+        foreach ($nodes as $node) {
+            $value    = (string) $node->nodeValue;
+            $values[] = Zend_Service_Ebay_Abstract::toPhpValue($value, $type);
+            if (!$array) {
+                break;
+            }
+        }
+
+        // array
+        if ($array) {
+            return $values;
+        }
+
+        // single value
+        if (count($values)) {
+            return reset($values);
+        }
+
+        // no nodes fount
+        return null;
+    }
+}

+ 79 - 0
library/Zend/Service/Ebay/Finding/Aspect.php

@@ -0,0 +1,79 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Aspect.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Aspect extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Container that returns the name of the respective aspect value and the
+     * histogram (the number of available items) that share that item
+     * characteristic.
+     *
+     * @var Zend_Service_Ebay_Finding_Aspect_Histogram_Value_Set
+     */
+    public $valueHistogram;
+
+    /**
+     * Name of an aspect value.
+     *
+     * Use array key to associate a name from this attribute to value set.
+     *
+     * For example, "Short Sleeve" could be an aspect value of the Sleeve Style
+     * aspect in the Women's Dresses domain, or "Athletic" could be an aspect
+     * value of the Style aspect in the Men's Shoes domain.
+     *
+     * @var string[]
+     */
+    public $valueHistogram_valueName;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->valueHistogram_valueName = $this->_query(".//$ns:valueHistogram/@valueName", 'string', true);
+
+        $nodes = $this->_xPath->query(".//$ns:valueHistogram", $this->_dom);
+        if ($nodes->length > 0) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Aspect_Histogram_Value_Set
+             */
+            require_once 'Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php';
+            $this->valueHistogram = new Zend_Service_Ebay_Finding_Aspect_Histogram_Value_Set($nodes);
+        }
+    }
+}

+ 119 - 0
library/Zend/Service/Ebay/Finding/Aspect/Histogram/Container.php

@@ -0,0 +1,119 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Container.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Aspect_Histogram_Container extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * A characteristic of an item in a domain.
+     *
+     * For example, "Optical Zoom", "Brand", and "Megapixels" could be aspects
+     * of the Digital Cameras domain. Aspects are well-known, standardized
+     * characteristics of a domain, and they vary from domain to domain (the
+     * aspects of "Men's Shoes" are different from those of "Digital Cameras").
+     * A search request on the eBay site will often display aspects and their
+     * respective aspect values on the left-had side of a query response.
+     *
+     * Aspects are extracted from item listing properties (such as item titles
+     * and subtitles), and represent the characteristics of active items. Values
+     * returned in the Aspect container can be used as inputs to the
+     * aspectFilter fields in a query to distill the items returned by the
+     * query. eBay generates aspects dynamically from the items currently
+     * listed; aspects provide a view into what is currently available on eBay.
+     * Because of this, aspect values returned one day cannot be guaranteed to
+     * be valid the next day.
+     *
+     * @var Zend_Service_Ebay_Finding_Aspect_Set
+     */
+    public $aspect;
+
+    /**
+     * Names of aspects that is part of a domain.
+     *
+     * Use array key to associate a name from this attribute to aspect set. This
+     * value is not returned if there are no matching aspects for the associated
+     * domain.
+     *
+     * For example, "Optical Zoom" or "Megapixels" could be aspects of the
+     * Digital Cameras domain. For the current aspect names associated with a
+     * specific item, refer to the aspectHistogramContainer returned for the
+     * respective item.
+     *
+     * @var string[]
+     */
+    public $aspect_name = array();
+
+    /**
+     * A buy-side group of items, for example "Shoes.".
+     *
+     * Domains are extracted from item listing properties, such as the title,
+     * descriptions, and so on.
+     *
+     * @var string
+     */
+    public $domainDisplayName;
+
+    /**
+     * A buy-side group of items that share aspects, but not necessarily an eBay
+     * category.
+     *
+     * For example "Women's Dresses" or "Digital Cameras" could be domains. You
+     * can use a domainName to label a set of aspects that you display.
+     *
+     * @var string
+     */
+    public $domainName;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->aspect_name       = $this->_query(".//$ns:aspect/@name", 'string', true);
+        $this->domainDisplayName = $this->_query(".//$ns:domainDisplayName[1]", 'string');
+        $this->domainName        = $this->_query(".//$ns:domainName[1]", 'string');
+
+        $nodes = $this->_xPath->query(".//$ns:aspect", $this->_dom);
+        if ($nodes->length > 0) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Aspect_Set
+             */
+            require_once 'Zend/Service/Ebay/Finding/Aspect/Set.php';
+            $this->aspect = new Zend_Service_Ebay_Finding_Aspect_Set($nodes);
+        }
+    }
+}

+ 56 - 0
library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value.php

@@ -0,0 +1,56 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Value.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Aspect_Histogram_Value extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Number of items that share the characteristic the respective aspect
+     * value.
+     *
+     * @var integer
+     */
+    public $count;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->count = $this->_query(".//$ns:count[1]", 'integer');
+    }
+}

+ 57 - 0
library/Zend/Service/Ebay/Finding/Aspect/Histogram/Value/Set.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Set.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Set_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Set/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Set_Abstract
+ */
+class Zend_Service_Ebay_Finding_Aspect_Histogram_Value_Set extends Zend_Service_Ebay_Finding_Set_Abstract
+{
+    /**
+     * Implement SeekableIterator::current()
+     *
+     * @return Zend_Service_Ebay_Finding_Aspect_Histogram_Value
+     */
+    public function current()
+    {
+        // check node
+        $node = $this->_nodes->item($this->_key);
+        if (!$node) {
+            return null;
+        }
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Aspect_Histogram_Value
+         */
+        require_once 'Zend/Service/Ebay/Finding/Aspect/Histogram/Value.php';
+        return new Zend_Service_Ebay_Finding_Aspect_Histogram_Value($node);
+    }
+}

+ 57 - 0
library/Zend/Service/Ebay/Finding/Aspect/Set.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Set.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Set_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Set/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Set_Abstract
+ */
+class Zend_Service_Ebay_Finding_Aspect_Set extends Zend_Service_Ebay_Finding_Set_Abstract
+{
+    /**
+     * Implement SeekableIterator::current()
+     *
+     * @return Zend_Service_Ebay_Finding_Aspect
+     */
+    public function current()
+    {
+        // check node
+        $node = $this->_nodes->item($this->_key);
+        if (!$node) {
+            return null;
+        }
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Aspect
+         */
+        require_once 'Zend/Service/Ebay/Finding/Aspect.php';
+        return new Zend_Service_Ebay_Finding_Aspect($node);
+    }
+}

+ 73 - 0
library/Zend/Service/Ebay/Finding/Category.php

@@ -0,0 +1,73 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Category.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Category extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * The unique ID of a category on the specified eBay site.
+     *
+     * @var string
+     */
+    public $categoryId;
+
+    /**
+     * Display name of a category as it appears on the eBay Web site.
+     *
+     * @var string
+     */
+    public $categoryName;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->categoryId   = $this->_query(".//$ns:categoryId[1]", 'string');
+        $this->categoryName = $this->_query(".//$ns:categoryName[1]", 'string');
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  Zend_Config|array         $options
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItems(Zend_Service_Ebay_Finding $proxy, $options = null)
+    {
+        return $proxy->findItemsByCategory($this->categoryId, $options);
+    }
+}

+ 77 - 0
library/Zend/Service/Ebay/Finding/Category/Histogram.php

@@ -0,0 +1,77 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Histogram.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Category.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Category
+ */
+class Zend_Service_Ebay_Finding_Category_Histogram extends Zend_Service_Ebay_Finding_Category
+{
+    /**
+     * Container for histogram information pertaining to a child of the category
+     * specified in the request.
+     *
+     * Histograms return data on up to 10 children. Histograms are only a single
+     * level deep. That is, a given category histogram contains only immediate
+     * children.
+     *
+     * @var Zend_Service_Ebay_Finding_Category_Histogram_Set
+     */
+    public $childCategoryHistogram;
+
+    /**
+     * The total number of items in the associated category that match the
+     * search criteria.
+     *
+     * @var integer
+     */
+    public $count;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->count = $this->_query(".//$ns:count[1]", 'integer');
+
+        $nodes = $this->_xPath->query(".//$ns:childCategoryHistogram", $this->_dom);
+        if ($nodes->length > 0) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Category_Histogram_Set
+             */
+            require_once 'Zend/Service/Ebay/Finding/Category/Histogram/Set.php';
+            $this->childCategoryHistogram = new Zend_Service_Ebay_Finding_Category_Histogram_Set($nodes);
+        }
+    }
+}

+ 66 - 0
library/Zend/Service/Ebay/Finding/Category/Histogram/Container.php

@@ -0,0 +1,66 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Container.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Category_Histogram_Container extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Response container for category histograms.
+     *
+     * This container is returned only when the specified category has children
+     * categories.
+     *
+     * @var Zend_Service_Ebay_Finding_Category_Histogram_Set
+     */
+    public $categoryHistogram;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+
+        $nodes = $this->_xPath->query(".//$ns:categoryHistogram", $this->_dom);
+        if ($nodes->length > 0) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Category_Histogram_Set
+             */
+            require_once 'Zend/Service/Ebay/Finding/Category/Histogram/Set.php';
+            $this->categoryHistogram = new Zend_Service_Ebay_Finding_Category_Histogram_Set($nodes);
+        }
+    }
+}

+ 57 - 0
library/Zend/Service/Ebay/Finding/Category/Histogram/Set.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Set.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Set_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Set/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Set_Abstract
+ */
+class Zend_Service_Ebay_Finding_Category_Histogram_Set extends Zend_Service_Ebay_Finding_Set_Abstract
+{
+    /**
+     * Implement SeekableIterator::current()
+     *
+     * @return Zend_Service_Ebay_Finding_Category_Histogram
+     */
+    public function current()
+    {
+        // check node
+        $node = $this->_nodes->item($this->_key);
+        if (!$node) {
+            return null;
+        }
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Category_Histogram
+         */
+        require_once 'Zend/Service/Ebay/Finding/Category/Histogram.php';
+        return new Zend_Service_Ebay_Finding_Category_Histogram($node);
+    }
+}

+ 166 - 0
library/Zend/Service/Ebay/Finding/Error/Data.php

@@ -0,0 +1,166 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Data.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Error_Data extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * There are three categories of errors: request errors, application errors,
+     * and system errors.
+     *
+     * @var string
+     */
+    public $category;
+
+    /**
+     * Name of the domain in which the error occurred.
+     *
+     * Domain values
+     *
+     * Marketplace: A business or validation error occurred in the service.
+     *
+     * SOA: An exception occurred in the Service Oriented Architecture (SOA)
+     * framework.
+     *
+     * @var string
+     */
+    public $domain;
+
+    /**
+     * A unique code that identifies the particular error condition that
+     * occurred. Your application can use error codes as identifiers in your
+     * customized error-handling algorithms.
+     *
+     * @var integer
+     */
+    public $errorId;
+
+    /**
+     * Unique identifier for an exception associated with an error.
+     *
+     * @var string
+     */
+    public $exceptionId;
+
+    /**
+     * A detailed description of the condition that caused in the error.
+     *
+     * @var string
+     */
+    public $message;
+
+    /**
+     * Various warning and error messages return one or more variables that
+     * contain contextual information about the error. This is often the field
+     * or value that triggered the error.
+     *
+     * @var string[]
+     */
+    public $parameter;
+
+    /**
+     * The name of the input parameter returned with the error.
+     *
+     * Inspecting the parameter (or its input value) will often aid in
+     * understanding the cause of the error. Not all error messages contain this
+     * value.
+     *
+     * @var string[]
+     */
+    public $parameter_name;
+
+    /**
+     * Indicates whether the reported problem is fatal (an error) or is
+     * less-severe (a warning). Review the error message details for information
+     * on the cause.
+     *
+     * This API throws an exception when a fatal error occurs. Only warning
+     * problems can fill this attribute. See more about error parsing at
+     * {@Zend_Service_Ebay_Finding::_parseResponse()}.
+     *
+     * If the request fails and the application is the source of the error (for
+     * example, a required element is missing), update the application before
+     * you retry the request. If the problem is due to incorrect user data,
+     * alert the end-user to the problem and provide the means for them to
+     * correct the data. Once the problem in the application or data is
+     * resolved, re-send the request to eBay.
+     *
+     * If the source of the problem is on eBay's side, you can retry the request
+     * a reasonable number of times (eBay recommends you try the request twice).
+     * If the error persists, contact Developer Technical Support. Once the
+     * problem has been resolved, you can resend the request in its original
+     * form.
+     *
+     * If a warning occurs, warning information is returned in addition to the
+     * business data. Normally, you do not need to resend the request (as the
+     * original request was successful). However, depending on the cause of the
+     * warning, you might need to contact the end user, or eBay, to effect a
+     * long term solution to the problem.
+     *
+     * @var string
+     */
+    public $severity;
+
+    /**
+     * Name of the subdomain in which the error occurred.
+     *
+     * Subdomain values
+     *
+     * Finding: The error is specific to the Finding service.
+     *
+     * MarketplaceCommon: The error is common to all Marketplace services.
+     *
+     * @var string
+     */
+    public $subdomain;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->category       = $this->_query(".//$ns:category[1]", 'string');
+        $this->domain         = $this->_query(".//$ns:domain[1]", 'string');
+        $this->errorId        = $this->_query(".//$ns:errorId[1]", 'integer');
+        $this->exceptionId    = $this->_query(".//$ns:exceptionId[1]", 'string');
+        $this->message        = $this->_query(".//$ns:message[1]", 'string');
+        $this->parameter      = $this->_query(".//$ns:parameter", 'string', true);
+        $this->parameter_name = $this->_query(".//$ns:parameter/@name", 'string', true);
+        $this->severity       = $this->_query(".//$ns:severity[1]", 'string');
+        $this->subdomain      = $this->_query(".//$ns:subdomain[1]", 'string');
+    }
+}

+ 57 - 0
library/Zend/Service/Ebay/Finding/Error/Data/Set.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Set.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Set_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Set/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Set_Abstract
+ */
+class Zend_Service_Ebay_Finding_Error_Data_Set extends Zend_Service_Ebay_Finding_Set_Abstract
+{
+    /**
+     * Implement SeekableIterator::current()
+     *
+     * @return Zend_Service_Ebay_Finding_Error_Data
+     */
+    public function current()
+    {
+        // check node
+        $node = $this->_nodes->item($this->_key);
+        if (!$node) {
+            return null;
+        }
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Error_Data
+         */
+        require_once 'Zend/Service/Ebay/Finding/Error/Data.php';
+        return new Zend_Service_Ebay_Finding_Error_Data($node);
+    }
+}

+ 60 - 0
library/Zend/Service/Ebay/Finding/Error/Message.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Message.php 22802 2010-08-07 19:27:37Z ramon $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Error_Message extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * A container for error details.
+     *
+     * @var Zend_Service_Ebay_Finding_Error_Data_Set
+     */
+    public $error;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+        $nodes = $this->_xPath->query(".//$ns:error", $this->_dom);
+        if ($nodes->length > 0) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Error_Data_Set
+             */
+            require_once 'Zend/Service/Ebay/Finding/Error/Data/Set.php';
+            $this->error = new Zend_Service_Ebay_Finding_Error_Data_Set($nodes);
+        }
+    }
+}

+ 37 - 0
library/Zend/Service/Ebay/Finding/Exception.php

@@ -0,0 +1,37 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Exception.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Exception
+ */
+require_once 'Zend/Service/Ebay/Exception.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Exception
+ */
+class Zend_Service_Ebay_Finding_Exception extends Zend_Service_Ebay_Exception
+{}

+ 221 - 0
library/Zend/Service/Ebay/Finding/ListingInfo.php

@@ -0,0 +1,221 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: ListingInfo.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_ListingInfo extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Shows whether or not the seller will accept a best offer for the
+     * associated item.
+     *
+     * Best Offer allows a buyer to make a lower-priced binding offer on a fixed
+     * price item. Buyers cannot see how many offers have been made (only the
+     * seller can see this information). To make a best offer on a listing, use
+     * the eBay Web site.
+     *
+     * @var boolean
+     */
+    public $bestOfferEnabled;
+
+    /**
+     * Used with competitive-bid auctions, the associated item includes a Buy It
+     * Now option if this value returns true.
+     *
+     * Buy It Now lets a user purchase the item at a fixed price, effectively
+     * ending the auction. On most sites, the Buy It Now option is removed (and
+     * this value returns false) once a valid bid is made on the associated item
+     * (a valid bid could be a bid above the reserve price).
+     *
+     * @var boolean
+     */
+    public $buyItNowAvailable;
+
+    /**
+     * The Buy It Now Price of the item (if any), in the currency of the site on
+     * which the item was listed.
+     *
+     * You can use this field to determine if the item was originally listed
+     * with Buy It Now, even if the Buy It Now option is no longer available for
+     * the item.
+     *
+     * For Basic Fixed-Price (FixedPrice), Store Inventory (StoreInventory), and
+     * Ad Format (AdFormat) listings, currentPrice is the current fixed price.
+     *
+     * Only returned if an item was listed with Buy It Now.
+     *
+     * @var float
+     */
+    public $buyItNowPrice;
+
+    /**
+     * Currency in which the monetary amount is specified.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/currencyIdList.html
+     * @var  string
+     */
+    public $buyItNowPrice_currencyId;
+
+    /**
+     * The listing's Buy It Now Price (if any), converted into the currency of
+     * the site to which you sent your search request.
+     *
+     * For active items, refresh this value every 24 hours to pick up changes in
+     * conversion rates (if this value has been converted).
+     *
+     * Price fields are returned as doubles, not necessarily in the traditional
+     * monetary format of the site's country. For example, a US Dollar value
+     * might be returned as 3.880001 instead of 3.88.
+     *
+     * Only returned if an item was listed with Buy It Now.
+     *
+     * @var float
+     */
+    public $convertedBuyItNowPrice;
+
+    /**
+     * Currency in which the monetary amount is specified.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/currencyIdList.html
+     * @var  string
+     */
+    public $convertedBuyItNowPrice_currencyId;
+
+    /**
+     * Time stamp specifying when the listing is scheduled to end, or the actual
+     * end time if the item listing has ended.
+     *
+     * This value is returned in GMT, the ISO 8601 date and time format
+     * (YYYY-MM-DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about
+     * the time format, and for details on converting to and from the GMT time
+     * zone.
+     *
+     * @var integer
+     */
+    public $endTime;
+
+    /**
+     * If true, a generic gift icon displays next the listing's title in search
+     * and browse pages.
+     *
+     * @var boolean
+     */
+    public $gift;
+
+    /**
+     * The format of the listing, such as online auction, fixed price, or
+     * advertisement.
+     *
+     * Applicable values:
+     *
+     *     AdFormat
+     *     Advertisement to solicit inquiries on listings such as real estate.
+     *     Permits no bidding on that item, service, or property. To express
+     *     interest, a buyer fills out a contact form that eBay forwards to the
+     *     seller as a lead. This format does not enable buyers and sellers to
+     *     transact online through eBay and eBay Feedback is not available for
+     *     ad format listings.
+     *
+     *     Auction
+     *     Competitive-bid online auction format. Buyers engage in competitive
+     *     bidding, although Buy It Now may be offered as long as no valid bids
+     *     have been placed. Online auctions are listed on eBay.com; they can
+     *     also be listed in a seller's eBay Store if the seller is a Store
+     *     owner.
+     *
+     *     AuctionWithBIN
+     *     Same as Auction format, but Buy It Now is enabled. AuctionWithBIN
+     *     changes to Auction if a valid bid has been placed on the item. Valid
+     *     bids include bids that are equal to or above any specified reserve
+     *     price.
+     *
+     *     Classified
+     *     Classified Ads connect buyers and sellers, who then complete the sale
+     *     outside of eBay. This format does not enable buyers and sellers to
+     *     transact online through eBay and eBay Feedback is not available for
+     *     these listing types.
+     *
+     *     FixedPrice
+     *     A fixed-price listing. Auction-style bidding is not allowed. On some
+     *     sites, this auction format is also known as "Buy It Now Only" (not to
+     *     be confused with the Buy It Now option available with
+     *     competitive-bidding auctions). Fixed-price listings appear on
+     *     eBay.com; they can also be listed in a seller's eBay Store if the
+     *     seller is a Store owner.
+     *
+     *     StoreInventory
+     *     A fixed-price format for eBay Store sellers. Store Inventory listings
+     *     appear after other listings in regular browse and search item
+     *     listings on eBay. Store items have a lower Insertion Fee and longer
+     *     listing durations. This selling type can only be specified by sellers
+     *     who have an eBay Store. Store Inventory listings are listed on
+     *     eBay.com as well as in the seller's eBay Store.
+     *
+     * @var string
+     */
+    public $listingType;
+
+    /**
+     * Time stamp that eBay recorded as the moment the listing was made
+     * available.
+     *
+     * This value is returned in GMT, the ISO 8601 date and time format
+     * (YYYY-MM-DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about
+     * the time format, and for details on converting to and from the GMT time
+     * zone. Note that it is possible for startTime to be different from the
+     * value returned by GetSingleItem.
+     *
+     * @var integer
+     */
+    public $startTime;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->bestOfferEnabled                  = $this->_query(".//$ns:bestOfferEnabled[1]", 'boolean');
+        $this->buyItNowAvailable                 = $this->_query(".//$ns:buyItNowAvailable[1]", 'boolean');
+        $this->buyItNowPrice                     = $this->_query(".//$ns:buyItNowPrice[1]", 'float');
+        $this->buyItNowPrice_currencyId          = $this->_query(".//$ns:buyItNowPrice[1]/@currencyId[1]", 'string');
+        $this->convertedBuyItNowPrice            = $this->_query(".//$ns:convertedBuyItNowPrice[1]", 'float');
+        $this->convertedBuyItNowPrice_currencyId = $this->_query(".//$ns:convertedBuyItNowPrice[1]/@currencyId[1]", 'string');
+        $this->endTime                           = $this->_query(".//$ns:endTime[1]", 'string');
+        $this->gift                              = $this->_query(".//$ns:gift[1]", 'boolean');
+        $this->listingType                       = $this->_query(".//$ns:listingType[1]", 'string');
+        $this->startTime                         = $this->_query(".//$ns:startTime[1]", 'string');
+    }
+}

+ 115 - 0
library/Zend/Service/Ebay/Finding/PaginationOutput.php

@@ -0,0 +1,115 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: PaginationOutput.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_PaginationOutput extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * The maximum number of items that can be returned in the response.
+     *
+     * This number is always equal to the value input for
+     * paginationInput.entriesPerPage. The end of the result set has been
+     * reached if the number specified for entriesPerPage is greater than the
+     * number of items found on the specified pageNumber. In this case, there
+     * will be fewer items returned than the number specified in entriesPerPage.
+     * This can be determined by comparing the entriesPerPage value with the
+     * value returned in the count attribute for the searchResult field.
+     *
+     * @var integer
+     */
+    public $entriesPerPage;
+
+    /**
+     * The subset of item data returned in the current response.
+     *
+     * Search results are divided into sets, or "pages," of item data. The
+     * number of pages is equal to the total number of items matching the search
+     * criteria divided by the value specified for entriesPerPage in the
+     * request. The response for a request contains one "page" of item data.
+     *
+     * This returned value indicates the page number of item data returned (a
+     * subset of the complete result set). If this field contains 1, the
+     * response contains the first page of item data (the default). If the value
+     * returned in totalEntries is less than the value for entriesPerPage,
+     * pageNumber returns 1 and the response contains the entire result set.
+     *
+     * The value of pageNumber is normally equal to the value input for
+     * paginationInput.pageNumber. However, if the number input for pageNumber
+     * is greater than the total possible pages of output, eBay returns the last
+     * page of item data in the result set, and the value for pageNumber is set
+     * to the respective (last) page number.
+     *
+     * @var integer
+     */
+    public $pageNumber;
+
+    /**
+     * The total number of items found that match the search criteria in your
+     * request.
+     *
+     * Depending on the input value for entriesPerPage, the response might
+     * include only a portion (a page) of the entire result set. A value of "0"
+     * is returned if eBay does not find any items that match the search
+     * criteria.
+     *
+     * @var integer
+     */
+    public $totalEntries;
+
+    /**
+     * The total number of pages of data that could be returned by repeated
+     * search requests.
+     *
+     * Note that if you modify the value of inputPagination.entriesPerPage in a
+     * request, the value output for totalPages will change. A value of "0" is
+     * returned if eBay does not find any items that match the search criteria.
+     *
+     * @var integer
+     */
+    public $totalPages;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->entriesPerPage = $this->_query(".//$ns:entriesPerPage[1]", 'integer');
+        $this->pageNumber     = $this->_query(".//$ns:pageNumber[1]", 'integer');
+        $this->totalEntries   = $this->_query(".//$ns:totalEntries[1]", 'integer');
+        $this->totalPages     = $this->_query(".//$ns:totalPages[1]", 'integer');
+    }
+}

+ 185 - 0
library/Zend/Service/Ebay/Finding/Response/Abstract.php

@@ -0,0 +1,185 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Abstract.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+abstract class Zend_Service_Ebay_Finding_Response_Abstract extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Indicates whether or not errors or warnings were generated during the
+     * processing of the request.
+     *
+     * Applicable values:
+     *
+     *     Failure
+     *     eBay encountered a fatal error during the processing of the request,
+     *     causing the request to fail. When a serious application-level error
+     *     occurs, the error is returned instead of the business data.
+     *
+     *     PartialFailure
+     *     eBay successfully processed the request, but one or more non-fatal
+     *     errors occurred during the processing. For best results, requests
+     *     should return without warning messages. Inspect the message details
+     *     and resolve any problems before resubmitting the request.
+     *
+     *     Success
+     *     eBay successfully processed the request and the business data is
+     *     returned in the response. Note that it is possible for a response to
+     *     return Success, but still not contain the expected data in the result.
+     *
+     *     Warning
+     *     The request was successfully processed, but eBay encountered a
+     *     non-fatal error during the processing. For best results, requests
+     *     should return without warnings. Inspect the warning details and
+     *     resolve the problem before resubmitting the request.
+     *
+     * @var string
+     */
+    public $ack;
+
+    /**
+     * Information regarding an error or warning that occurred when eBay
+     * processed the request.
+     *
+     * Not returned when the ack value is Success. Run-time errors are not
+     * reported here.
+     *
+     * @var Zend_Service_Ebay_Finding_Error_Message
+     */
+    public $errorMessage;
+
+    /**
+     * This value represents the date and time when eBay processed the request.
+     *
+     * This value is returned in GMT, the ISO 8601 date and time format
+     * (YYYY-MM-DDTHH:MM:SS.SSSZ). See the "dateTime" type for information about
+     * the time format, and for details on converting to and from the GMT time
+     * zone.
+     *
+     * @var string
+     */
+    public $timestamp;
+
+    /**
+     * The release version that eBay used to process the request.
+     *
+     * Developer Technical Support may ask you for the version value if you work
+     * with them to troubleshoot issues.
+     *
+     * @var string
+     */
+    public $version;
+
+    /**
+     * @var string
+     */
+    protected $_operation;
+
+    /**
+     * @var array
+     */
+    protected $_options = array();
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->ack       = $this->_query(".//$ns:ack[1]", 'string');
+        $this->timestamp = $this->_query(".//$ns:timestamp[1]", 'string');
+        $this->version   = $this->_query(".//$ns:version[1]", 'string');
+
+        $node = $this->_xPath->query(".//$ns:errorMessage[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Error_Message
+             */
+            require_once 'Zend/Service/Ebay/Finding/Error/Message.php';
+            $this->errorMessage = new Zend_Service_Ebay_Finding_Error_Message($node);
+        }
+    }
+
+    /**
+     * @param  string $operation
+     * @return Zend_Service_Ebay_Finding_Response_Abstract Provides a fluent interface
+     */
+    public function setOperation($operation)
+    {
+        $this->_operation = (string) $operation;
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getOperation()
+    {
+        return $this->_operation;
+    }
+
+    /**
+     * @param  string|Zend_Config|array $name
+     * @param  mixed                    $value
+     * @return Zend_Service_Ebay_Finding_Response_Abstract Provides a fluent interface
+     */
+    public function setOption($name, $value = null)
+    {
+        if ($name instanceof Zend_Config) {
+            $name = $name->toArray();
+        }
+        if (is_array($name)) {
+            $this->_options = $name;
+        } else {
+            $this->_options[$name] = $value;
+        }
+        return $this;
+    }
+
+    /**
+     * @param  string $name
+     * @return mixed
+     */
+    public function getOption($name = null)
+    {
+        if (null === $name) {
+            return $this->_options;
+        }
+        if (array_key_exists($name, $this->_options)) {
+            return $this->_options[$name];
+        }
+        return null;
+    }
+}

+ 86 - 0
library/Zend/Service/Ebay/Finding/Response/Histograms.php

@@ -0,0 +1,86 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Histograms.php 22804 2010-08-08 05:08:05Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Response_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Response/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Response_Abstract
+ */
+class Zend_Service_Ebay_Finding_Response_Histograms extends Zend_Service_Ebay_Finding_Response_Abstract
+{
+    /**
+     * Response container for aspect histograms.
+     *
+     * Aspect histograms are returned for categories that have been mapped to
+     * domains only. In most cases, just leaf categories are mapped to domains,
+     * but there are exceptions.
+     *
+     * @var Zend_Service_Ebay_Finding_Aspect_Histogram_Container
+     */
+    public $aspectHistogramContainer;
+
+    /**
+     * Response container for category histograms.
+     *
+     * This container is returned only when the specified category has children
+     * categories.
+     *
+     * @var Zend_Service_Ebay_Finding_Category_Histogram_Container
+     */
+    public $categoryHistogramContainer;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+
+        $node = $this->_xPath->query(".//$ns:aspectHistogramContainer[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Aspect_Histogram_Container
+             */
+            require_once 'Zend/Service/Ebay/Finding/Aspect/Histogram/Container.php';
+            $this->aspectHistogramContainer = new Zend_Service_Ebay_Finding_Aspect_Histogram_Container($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:categoryHistogramContainer[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Category_Histogram_Container
+             */
+            require_once 'Zend/Service/Ebay/Finding/Category/Histogram/Container.php';
+            $this->categoryHistogramContainer = new Zend_Service_Ebay_Finding_Category_Histogram_Container($node);
+        }
+    }
+}

+ 258 - 0
library/Zend/Service/Ebay/Finding/Response/Items.php

@@ -0,0 +1,258 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Items.php 22804 2010-08-08 05:08:05Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Response_Histograms
+ */
+require_once 'Zend/Service/Ebay/Finding/Response/Histograms.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Response_Histograms
+ */
+class Zend_Service_Ebay_Finding_Response_Items extends Zend_Service_Ebay_Finding_Response_Histograms
+{
+    /**
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/types/PaginationInput.html
+     */
+    const PAGE_MAX_DEFAULT  = 100;
+    const PAGE_MAX_INFINITY = 0;
+
+    /**
+     * Indicates the pagination of the result set.
+     *
+     * Child elements indicate the page number that is returned, the maximum
+     * number of item listings to return per page, total number of pages that
+     * can be returned, and the total number of listings that match the search
+     * criteria.
+     *
+     * @var Zend_Service_Ebay_Finding_PaginationOutput
+     */
+    public $paginationOutput;
+
+    /**
+     * Container for the item listings that matched the search criteria.
+     *
+     * The data for each item is returned in individual containers, if any
+     * matches were found.
+     *
+     * @var Zend_Service_Ebay_Finding_Search_Result
+     */
+    public $searchResult;
+
+    /**
+     * The total number of items returned in the search response.
+     *
+     * This is often equal to the entriesPerPage value. If the count is less
+     * than the specified entriesPerPage, it indicates the end of the result
+     * set.
+     *
+     * @var integer
+     */
+    public $searchResult_count;
+
+    /**
+     * @var Zend_Service_Ebay_Finding_Response_Items[]
+     */
+    protected static $_pageCache = array();
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->searchResult_count = $this->_query(".//$ns:searchResult[1]/@count[1]", 'string');
+
+        $node = $this->_xPath->query(".//$ns:searchResult[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Search_Result
+             */
+            require_once 'Zend/Service/Ebay/Finding/Search/Result.php';
+            $this->searchResult = new Zend_Service_Ebay_Finding_Search_Result($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:paginationOutput[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_PaginationOutput
+             */
+            require_once 'Zend/Service/Ebay/Finding/PaginationOutput.php';
+            $this->paginationOutput = new Zend_Service_Ebay_Finding_PaginationOutput($node);
+        }
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  integer                   $number
+     * @throws Zend_Service_Ebay_Finding_Exception When $number is invalid
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function page(Zend_Service_Ebay_Finding $proxy, $number)
+    {
+        // check page number
+        if ($number < 1 || $number > $this->paginationOutput->totalPages) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Exception
+             */
+            require_once 'Zend/Service/Ebay/Finding/Exception.php';
+            throw new Zend_Service_Ebay_Finding_Exception(
+                "Page number '{$number}' is out of range.");
+        }
+
+        // prepare arguments
+        $arguments = array();
+        switch ($this->_operation) {
+            case 'findItemsAdvanced':
+                $arguments[] = $this->getOption('keywords');
+                $arguments[] = $this->getOption('descriptionSearch');
+                $arguments[] = $this->getOption('categoryId');
+                break;
+
+            case 'findItemsByCategory':
+                $arguments[] = $this->getOption('categoryId');
+                break;
+
+            case 'findItemsByKeywords':
+                $arguments[] = $this->getOption('keywords');
+                break;
+
+            case 'findItemsByProduct':
+                $productId = $this->getOption('productId');
+                if (!is_array($productId)) {
+                    $productId = array('' => $productId);
+                }
+                $arguments[] = array_key_exists('', $productId)
+                             ? $productId['']
+                             : null;
+                $arguments[] = array_key_exists('type', $productId)
+                             ? $productId['type']
+                             : null;
+                break;
+
+            case 'findItemsIneBayStores':
+                $arguments[] = $this->getOption('storeName');
+                break;
+
+            default:
+                /**
+                 * @see Zend_Service_Ebay_Finding_Exception
+                 */
+                require_once 'Zend/Service/Ebay/Finding/Exception.php';
+                throw new Zend_Service_Ebay_Finding_Exception(
+                    "Invalid operation '{$this->_operation}'.");
+        }
+
+        // prepare options
+        // remove every pagination entry from current option list
+        $options = $this->_options;
+        foreach (array_keys($options) as $optionName) {
+            if (substr($optionName, 0, 15) == 'paginationInput') {
+                unset($options[$optionName]);
+            }
+        }
+
+        // set new pagination values
+        // see more at http://developer.ebay.com/DevZone/finding/CallRef/types/PaginationInput.html
+        $entriesPerPage             = $this->paginationOutput->entriesPerPage;
+        $options['paginationInput'] = array('entriesPerPage' => $entriesPerPage,
+                                            'pageNumber'     => $number);
+
+        // add current options as last argument
+        ksort($options);
+        $arguments[] = $options;
+
+        // verify cache
+        $id = serialize($arguments);
+        if (!array_key_exists($id, self::$_pageCache)) {
+            if ($number == $this->paginationOutput->pageNumber) {
+                // add itself to cache
+                $new = $this;
+            } else {
+                // request new page
+                $callback = array($proxy, $this->_operation);
+                $new      = call_user_func_array($callback, $arguments);
+            }
+            self::$_pageCache[$id] = $new;
+        }
+
+        return self::$_pageCache[$id];
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function pageFirst(Zend_Service_Ebay_Finding $proxy)
+    {
+        return $this->page($proxy, 1);
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  integer                   $max
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function pageLast(Zend_Service_Ebay_Finding $proxy, $max = self::PAGE_MAX_DEFAULT)
+    {
+        $last = $this->paginationOutput->totalPages;
+        if ($max > 0 && $last > $max) {
+            $last = $max;
+        }
+        return $this->page($proxy, $last);
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  integer                   $max
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function pageNext(Zend_Service_Ebay_Finding $proxy, $max = self::PAGE_MAX_DEFAULT)
+    {
+        $next = $this->paginationOutput->pageNumber + 1;
+        $last = $this->paginationOutput->totalPages;
+        if (($max > 0 && $next > $max) || $next > $last) {
+            return null;
+        }
+        return $this->page($proxy, $next);
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function pagePrevious(Zend_Service_Ebay_Finding $proxy)
+    {
+        $previous = $this->paginationOutput->pageNumber - 1;
+        if ($previous < 1) {
+            return null;
+        }
+        return $this->page($proxy, $previous);
+    }
+}

+ 78 - 0
library/Zend/Service/Ebay/Finding/Response/Keywords.php

@@ -0,0 +1,78 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Keywords.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Response_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Response/Abstract.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding
+ */
+require_once 'Zend/Service/Ebay/Finding.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Response_Abstract
+ */
+class Zend_Service_Ebay_Finding_Response_Keywords extends Zend_Service_Ebay_Finding_Response_Abstract
+{
+    /**
+     * Contains a spell-checked version of the submitted keywords. If no
+     * recommended spelling can be identified for the submitted keywords, the
+     * response contains a warning to that effect and an empty keywords field
+     * is returned.
+     *
+     * @var string
+     */
+    public $keywords;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->keywords = $this->_query(".//$ns:keywords[1]", 'string');
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  Zend_Config|array         $options
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItems(Zend_Service_Ebay_Finding $proxy, $options = null)
+    {
+        // prepare options
+        $options = Zend_Service_Ebay_Abstract::optionsToArray($options);
+        $options = $options + $this->_options;
+
+        // find items
+        return $proxy->findItemsByKeywords($this->keywords, $options);
+    }
+}

+ 432 - 0
library/Zend/Service/Ebay/Finding/Search/Item.php

@@ -0,0 +1,432 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http:framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http:framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Item.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http:framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Search_Item extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * If true, the seller requires immediate payment for the item. If false (or
+     * not specified), immediate payment is not requested. Buyers must have a
+     * PayPal account to purchase items that require immediate payment.
+     *
+     * A seller can choose to require immediate payment for Fixed Price and Buy
+     * It Now listings, including eBay Stores Inventory listings. If a Buy It
+     * Now item ends as an auction (that is, if the Buy It Now option is removed
+     * due to bids being placed on the listing), the immediate payment
+     * requirement does not apply.
+     *
+     * @var boolean
+     */
+    public $autoPay;
+
+    /**
+     * A unique identification number assigned by eBay to registered nonprofit
+     * charity organizations.
+     *
+     * @var integer
+     */
+    public $charityId;
+
+    /**
+     * Two-letter ISO 3166 country code to indicate the country where the item
+     * is located.
+     *
+     * @link http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+     * @var  string
+     */
+    public $country;
+
+    /**
+     * The distance that the item is from the buyer, calculated usin
+     *  buyerPostalCode.
+     *
+     *  The unit for distance varies by site, and is either miles or kilometers.
+     *  If the country whose site you are searching uses kilometers to measure
+     *  distance (for example, India/EBAY-IN), the unit is kilometers. If the
+     *  site is either the US or UK, the distance unit is miles.
+     *
+     *  This value is only returned for distance-based searches. You must
+     *  specify a buyerPostalCode and either sort by Distance, or use a
+     *  combination of the MaxDistance LocalSearch itemFilters.
+     *
+     * @var float
+     */
+    public $distance;
+
+    /**
+     * Unit of measure used in a distance calculation.
+     *
+     * Units can be in either kilometers or miles, depending on the Global ID.
+     *
+     * @var string
+     */
+    public $distance_unit;
+
+    /**
+     * URL for the Gallery Plus image.
+     *
+     * The size of Gallery Plus images (up to 400 x 400 pixels) is bigger than
+     * the size of standard gallery images. In site search results, you can view
+     * the Gallery Plus image by hovering over or clicking the Enlarge link or
+     * magifying glass icon. The image uses one of the following graphics
+     * formats: JPEG, BMP, TIFF, or GIF. This field is only returned when the
+     * seller has opted for the Gallery Plus option for the given item.
+     *
+     * @var string[]
+     */
+    public $galleryPlusPictureURL;
+
+    /**
+     * URL for the Gallery thumbnail image.
+     *
+     * The image must be provided in one of the following graphics formats:
+     * JPEG, BMP, TIF, or GIF. Returned only if the seller chose to show a
+     * gallery image.
+     *
+     * @var string
+     */
+    public $galleryURL;
+
+    /**
+     * The identifier for the site on which the item is listed.
+     *
+     * Returns a Global ID, which is a unique identifier that specifies the
+     * combination of the site, language, and territory. In other eBay APIs
+     * (such as the Shopping API), this value is know as the site ID.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/GlobalIdList.html
+     * @var  string
+     */
+    public $globalId;
+
+    /**
+     * The ID that uniquely identifies the item listing.
+     *
+     * eBay generates this ID when an item is listed. ID values are unique
+     * across all eBay sites.
+     *
+     * @var string
+     */
+    public $itemId;
+
+    /**
+     * The format type of the listing, such as online auction, fixed price, or
+     * advertisement.
+     *
+     * @var Zend_Service_Ebay_Finding_ListingInfo
+     */
+    public $listingInfo;
+
+    /**
+     * Physical location of the item, as specified by the seller.
+     *
+     * This gives a general indication from where the item will be shipped (or
+     * delivered).
+     *
+     * @var string
+     */
+    public $location;
+
+    /**
+     * Identifies the payment method (or methods) the seller will accept for the
+     * item (such as PayPal).
+     *
+     *  Payment methods are not applicable to eBay Real Estate advertisement
+     *  listings or other Classified Ad listing formats.
+     *
+     * @link http://developer.ebay.com/DevZone/shopping/docs/CallRef/types/BuyerPaymentMethodCodeType.html
+     * @var  string[]
+     */
+    public $paymentMethod;
+
+    /**
+     * The postal code where the listed item is located.
+     *
+     * This field is returned only if a postal code has been specified by the
+     * seller. eBay proximity and local search behavior can use the combination
+     * of buyerPostalCode and postalCode values.
+     *
+     * @var string
+     */
+    public $postalCode;
+
+    /**
+     * Details about the first (or only) category in which the item is listed.
+     *
+     * Note that items can be listed in more than a single category.
+     *
+     * @var Zend_Service_Ebay_Finding_Category
+     */
+    public $primaryCategory;
+
+    /**
+     * Unique identifier for the eBay catalog product with which the item was
+     * listed.
+     *
+     * An eBay catalog product consists of pre-filled Item Specifics, additional
+     * descriptive information, plus a stock photo (if available). These product
+     * details are used to pre-fill item information, which is used to describe
+     * the item and can also help surface the item in searches.
+     *
+     * eBay supports the following types of product ID types: ISBN, UPC, EAN,
+     * and ReferenceID (ePID, also known as an eBay Product Reference ID).
+     * ReferenceID values are returned when available. A UPC, ISBN, or EAN
+     * product identifier will be returned only when a ReferenceID is not
+     * available.
+     *
+     * This productId value can be used as input with findItemsByProduct to
+     * retrieve items that were listed with the specified eBay catalog product.
+     *
+     * This field is only returned when a product was used to list the item.
+     *
+     * @var string
+     */
+    public $productId;
+
+    /**
+     * The nature of the identifier being used. For findItemsByProduct, search
+     * by a single type.
+     *
+     * Applicable values:
+     *
+     *     ReferenceID
+     *     The global reference ID (ePID) for an eBay catalog product. A
+     *     reference ID is a fixed reference to a product, regardless of
+     *     version. Use FindProducts in the Shopping API to determine valid ePID
+     *     values that you can use as input to findItemsByProduct. Each product
+     *     in the response includes its reference ID.
+     *
+     *     ISBN
+     *     ISBN-10 or ISBN-13 value for books. (The string length of ProductID
+     *     indicates whether the ID is 10 or 13 characters.) If you know a
+     *     book's ISBN, you can use this instead of the eBay Reference ID to
+     *     search for that book. Max length of corresponding value: 13
+     *
+     *     UPC
+     *     UPC value for products in Music (e.g., CDs), DVDs & Movies, and Video
+     *     Games categories (or domains). If you know a product's UPC, you can
+     *     use this instead of the eBay Reference ID to search for that product.
+     *     Max length of corresponding value: 12
+     *
+     *     EAN
+     *     EAN value for books. (This is used more commonly in European
+     *     countries.) If you know a book's EAN, you can use this instead of
+     *     the eBay Reference ID to search for that book. Max length of
+     *     corresponding value: 13
+     *
+     * @var string
+     */
+    public $productId_type;
+
+    /**
+     * Details about the second category in which the item is listed.
+     *
+     * This element is not returned if the seller did not specify a secondary
+     * category.
+     *
+     * @var Zend_Service_Ebay_Finding_Category
+     */
+    public $secondaryCategory;
+
+    /**
+     * Information about the item's seller.
+     *
+     * Only returned if SellerInfo is specified in the outputSelector field in
+     * the request.
+     *
+     * @var Zend_Service_Ebay_Finding_SellerInfo
+     */
+    public $sellerInfo;
+
+    /**
+     * Specifies the item's selling status with regards to eBay's processing
+     * workflow.
+     *
+     * @var Zend_Service_Ebay_Finding_SellingStatus
+     */
+    public $sellingStatus;
+
+    /**
+     * Container for data about a listing's shipping details.
+     *
+     * @var Zend_Service_Ebay_Finding_ShippingInfo
+     */
+    public $shippingInfo;
+
+    /**
+     * Information about the eBay store in which the item is listed.
+     *
+     * Only returned if the item is listed in a store and StoreInfo is specified
+     * in the outputSelector field in the request.
+     *
+     * @var Zend_Service_Ebay_Finding_Storefront
+     */
+    public $storeInfo;
+
+    /**
+     * Subtitle of the item.
+     *
+     * Only returned if the seller included a subtitle for the listing.
+     *
+     * @var string
+     */
+    public $subtitle;
+
+    /**
+     * Name of the item as it appears in the listing title, or in search and
+     * browse results.
+     *
+     * @var string
+     */
+    public $title;
+
+    /**
+     * The URL to view this specific listing on eBay.
+     *
+     * The returned URL is optimized to support natural search. That is, the URL
+     * is designed to make items on eBay easier to find via popular internet
+     * search engines. The URL includes the item title along with other
+     * optimizations. To note, "?" (question mark) optimizes to "_W0QQ", "&"
+     * (ampersand) optimizes to "QQ", and "=" (equals sign) optimizes to "Z".
+     *
+     * Do not modify the returned URLs in your application queries (for example,
+     * eBay won't recognize the URL if you change QQ to &). In the Sandbox
+     * environment (and on the Hong Kong site), the data returned in this field
+     * is a standard ViewItem URL rather than the ViewItemURL for natural
+     * search.
+     *
+     * @var string
+     */
+    public $viewItemURL;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->autoPay               = $this->_query(".//$ns:autoPay[1]", 'boolean');
+        $this->charityId             = $this->_query(".//$ns:charityId[1]", 'integer');
+        $this->country               = $this->_query(".//$ns:country[1]", 'string');
+        $this->distance              = $this->_query(".//$ns:distance[1]", 'float');
+        $this->distance_unit         = $this->_query(".//$ns:distance[1]/@unit[1]", 'string');
+        $this->galleryPlusPictureURL = $this->_query(".//$ns:galleryPlusPictureURL", 'string', true);
+        $this->galleryURL            = $this->_query(".//$ns:galleryURL[1]", 'string');
+        $this->globalId              = $this->_query(".//$ns:globalId[1]", 'string');
+        $this->itemId                = $this->_query(".//$ns:itemId[1]", 'string');
+        $this->location              = $this->_query(".//$ns:location[1]", 'string');
+        $this->paymentMethod         = $this->_query(".//$ns:paymentMethod", 'string', true);
+        $this->postalCode            = $this->_query(".//$ns:postalCode[1]", 'string');
+        $this->productId             = $this->_query(".//$ns:productId[1]", 'string');
+        $this->productId_type        = $this->_query(".//$ns:productId[1]/@type[1]", 'string');
+        $this->subtitle              = $this->_query(".//$ns:subtitle[1]", 'string');
+        $this->title                 = $this->_query(".//$ns:title[1]", 'string');
+        $this->viewItemURL           = $this->_query(".//$ns:viewItemURL[1]", 'string');
+
+        $node = $this->_xPath->query(".//$ns:listingInfo[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_ListingInfo
+             */
+            require_once 'Zend/Service/Ebay/Finding/ListingInfo.php';
+            $this->listingInfo = new Zend_Service_Ebay_Finding_ListingInfo($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:primaryCategory[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Category
+             */
+            require_once 'Zend/Service/Ebay/Finding/Category.php';
+            $this->primaryCategory = new Zend_Service_Ebay_Finding_Category($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:secondaryCategory[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Category
+             */
+            require_once 'Zend/Service/Ebay/Finding/Category.php';
+            $this->secondaryCategory = new Zend_Service_Ebay_Finding_Category($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:sellerInfo[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_SellerInfo
+             */
+            require_once 'Zend/Service/Ebay/Finding/SellerInfo.php';
+            $this->sellerInfo = new Zend_Service_Ebay_Finding_SellerInfo($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:sellingStatus[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_SellingStatus
+             */
+            require_once 'Zend/Service/Ebay/Finding/SellingStatus.php';
+            $this->sellingStatus = new Zend_Service_Ebay_Finding_SellingStatus($node);
+        }
+
+        $node = $this->_xPath->query("./$ns:shippingInfo", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_ShippingInfo
+             */
+            require_once 'Zend/Service/Ebay/Finding/ShippingInfo.php';
+            $this->shippingInfo = new Zend_Service_Ebay_Finding_ShippingInfo($node);
+        }
+
+        $node = $this->_xPath->query(".//$ns:storeInfo[1]", $this->_dom)->item(0);
+        if ($node) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Storefront
+             */
+            require_once 'Zend/Service/Ebay/Finding/Storefront.php';
+            $this->storeInfo = new Zend_Service_Ebay_Finding_Storefront($node);
+        }
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  Zend_Config|array         $options
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItemsByProduct(Zend_Service_Ebay_Finding $proxy, $options = null)
+    {
+        return $proxy->findItemsByProduct($this->productId, $this->productId_type, $options);
+    }
+}

+ 57 - 0
library/Zend/Service/Ebay/Finding/Search/Item/Set.php

@@ -0,0 +1,57 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Set.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Set_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Set/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Set_Abstract
+ */
+class Zend_Service_Ebay_Finding_Search_Item_Set extends Zend_Service_Ebay_Finding_Set_Abstract
+{
+    /**
+     * Implement SeekableIterator::current()
+     *
+     * @return Zend_Service_Ebay_Finding_Search_Item
+     */
+    public function current()
+    {
+        // check node
+        $node = $this->_nodes->item($this->_key);
+        if (!$node) {
+            return null;
+        }
+
+        /**
+         * @see Zend_Service_Ebay_Finding_Search_Item
+         */
+        require_once 'Zend/Service/Ebay/Finding/Search/Item.php';
+        return new Zend_Service_Ebay_Finding_Search_Item($node);
+    }
+}

+ 63 - 0
library/Zend/Service/Ebay/Finding/Search/Result.php

@@ -0,0 +1,63 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Result.php 22804 2010-08-08 05:08:05Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Search_Result extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Container for the data of a single item that matches the search criteria.
+     *
+     * @var Zend_Service_Ebay_Finding_Search_Item_Set
+     */
+    public $item;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+
+        $nodes = $this->_xPath->query(".//$ns:item", $this->_dom);
+        if ($nodes) {
+            /**
+             * @see Zend_Service_Ebay_Finding_Search_Item_Set
+             */
+            require_once 'Zend/Service/Ebay/Finding/Search/Item/Set.php';
+            $this->item = new Zend_Service_Ebay_Finding_Search_Item_Set($nodes);
+        }
+    }
+}

+ 144 - 0
library/Zend/Service/Ebay/Finding/SellerInfo.php

@@ -0,0 +1,144 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: SellerInfo.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_SellerInfo extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * Visual indicator of user's feedback score.
+     *
+     * Applicable values:
+     *
+     *     None
+     *     No graphic displayed, feedback score 0-9.
+     *
+     *     Yellow
+     *     Yellow Star, feedback score 10-49.
+     *
+     *     Blue
+     *     Blue Star, feedback score 50-99.
+     *
+     *     Turquoise
+     *     Turquoise Star, feedback score 100-499.
+     *
+     *     Purple
+     *     Purple Star, feedback score 500-999.
+     *
+     *     Red
+     *     Red Star, feedback score 1,000-4,999.
+     *
+     *     Green
+     *     Green Star, feedback score 5,000-9,999.
+     *
+     *     YellowShooting
+     *     Yellow Shooting Star, feedback score 10,000-24,999.
+     *
+     *     TurquoiseShooting
+     *     Turquoise Shooting Star, feedback score 25,000-49,999.
+     *
+     *     PurpleShooting
+     *     Purple Shooting Star, feedback score 50,000-99,999.
+     *
+     *     RedShooting
+     *     Red Shooting Star, feedback score 100,000-499,000 and above.
+     *
+     *     GreenShooting
+     *     Green Shooting Star, feedback score 500,000-999,000 and above.
+     *
+     *     SilverShooting
+     *     Silver Shooting Star, feedback score 1,000,000 or more.
+     *
+     * @var string
+     */
+    public $feedbackRatingStar;
+
+    /**
+     * The aggregate feedback score of the seller.
+     *
+     * A seller's feedback score is their net positive feedback minus their net
+     * negative feedback. Feedback scores are a quantitative expression of the
+     * desirability of dealing with a seller in a transaction.
+     *
+     * @var integer
+     */
+    public $feedbackScore;
+
+    /**
+     * The percentage value of a user's positive feedback (their positive
+     * feedbackScore divided by their total positive plus negative feedback).
+     *
+     * @var float
+     */
+    public $positiveFeedbackPercent;
+
+    /**
+     * The seller's eBay user name; a unique value.
+     *
+     * @var string
+     */
+    public $sellerUserName;
+
+    /**
+     * Indicates whether the seller of the item is top-rated.
+     *
+     * A top-rated seller:
+     *     - Consistently receives highest buyers' ratings
+     *     - Ships items quickly
+     *     - Has earned a track record of excellent service
+     *
+     * eBay regularly reviews the performance of these sellers to confirm they
+     * continue to meet the program's requirements.
+     *
+     * This field is returned for the following sites only: US (EBAY-US), Motors
+     * (EBAY-MOTOR), DE (EBAY-DE), AT (EBAY-AT), and CH (EBAY-CH).
+     *
+     * @var boolean
+     */
+    public $topRatedSeller;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->feedbackRatingStar      = $this->_query(".//$ns:feedbackRatingStar[1]", 'string');
+        $this->feedbackScore           = $this->_query(".//$ns:feedbackScore[1]", 'integer');
+        $this->positiveFeedbackPercent = $this->_query(".//$ns:positiveFeedbackPercent[1]", 'float');
+        $this->sellerUserName          = $this->_query(".//$ns:sellerUserName[1]", 'string');
+        $this->topRatedSeller          = $this->_query(".//$ns:topRatedSeller[1]", 'boolean');
+    }
+}

+ 140 - 0
library/Zend/Service/Ebay/Finding/SellingStatus.php

@@ -0,0 +1,140 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: SellingStatus.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_SellingStatus extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * The number of bids that have been placed on the item.
+     *
+     * @var integer
+     */
+    public $bidCount;
+
+    /**
+     * The listing's current price converted to the currency of the site
+     * specified in the find request (globalId).
+     *
+     * @var float
+     */
+    public $convertedCurrentPrice;
+
+    /**
+     * Currency in which the monetary amount is specified.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/currencyIdList.html
+     * @var  string
+     */
+    public $convertedCurrentPrice_currencyId;
+
+    /**
+     * The current price of the item given in the currency of the site on which
+     * the item is listed.
+     *
+     * That is, currentPrice is returned in the original listing currency.
+     *
+     * For competitive-bid item listings, currentPrice is the current minimum
+     * bid price if the listing has no bids, or the current high bid if the
+     * listing has bids. A Buy It Now price has no effect on currentPrice.
+     *
+     * For Basic Fixed-Price (FixedPrice), Store Inventory (StoreInventory), and
+     * Ad Format (AdFormat) listings, currentPrice is the current fixed price.
+     *
+     * @var float
+     */
+    public $currentPrice;
+
+    /**
+     * Currency in which the monetary amount is specified.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/currencyIdList.html
+     * @var  string
+     */
+    public $currentPrice_currencyId;
+
+    /**
+     * Specifies the listing's status in eBay's processing workflow.
+     *
+     * If an item's EndTime is in the past, but there are no details about the
+     * buyer or high bidder (and the user is not anonymous), you can use
+     * sellingState information to determine whether eBay has finished
+     * processing the listing.
+     *
+     * Applicable values:
+     *
+     *     Active
+     *     The listing is still live. It is also possible that the auction has
+     *     recently ended, but eBay has not completed the final processing
+     *     (e.g., the high bidder is still being determined).
+     *
+     *     Canceled
+     *     The listing has been canceled by either the seller or eBay.
+     *
+     *     Ended
+     *     The listing has ended and eBay has completed the processing of the
+     *     sale (if any).
+     *
+     * @var string
+     */
+    public $sellingState;
+
+    /**
+     * Time left before the listing ends.
+     *
+     * The duration is represented in the ISO 8601 duration format
+     * (PnYnMnDTnHnMnS). For listings that have ended, the time left is PT0S
+     * (zero seconds). See the "duration" type for information about this time
+     * format.
+     *
+     * @var string
+     */
+    public $timeLeft;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->bidCount                         = $this->_query(".//$ns:bidCount[1]", 'integer');
+        $this->convertedCurrentPrice            = $this->_query(".//$ns:convertedCurrentPrice[1]", 'float');
+        $this->convertedCurrentPrice_currencyId = $this->_query(".//$ns:convertedCurrentPrice[1]/@currencyId[1]", 'string');
+        $this->currentPrice                     = $this->_query(".//$ns:currentPrice[1]", 'float');
+        $this->currentPrice_currencyId          = $this->_query(".//$ns:currentPrice[1]/@currencyId[1]", 'string');
+        $this->sellingState                     = $this->_query(".//$ns:sellingState[1]", 'string');
+        $this->timeLeft                         = $this->_query(".//$ns:timeLeft[1]", 'string');
+    }
+}

+ 128 - 0
library/Zend/Service/Ebay/Finding/Set/Abstract.php

@@ -0,0 +1,128 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Abstract.php 20166 2010-01-09 19:00:17Z bkarwin $
+ */
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Service_Ebay_Finding_Set_Abstract implements SeekableIterator, Countable
+{
+    /**
+     * @var DOMNodeList
+     */
+    protected $_nodes;
+
+    /**
+     * @var integer
+     */
+    protected $_key = 0;
+
+    /**
+     * @param  DOMNodeList $nodes
+     * @return void
+     */
+    public function __construct(DOMNodeList $nodes)
+    {
+        $this->_nodes = $nodes;
+        $this->_init();
+    }
+
+    /**
+     * Initialize object.
+     *
+     * Called from {@link __construct()} as final step of object initialization.
+     *
+     * @return void
+     */
+    protected function _init()
+    {
+    }
+
+    /**
+     * Implement SeekableIterator::seek()
+     *
+     * @param  integer $key
+     * @throws OutOfBoundsException When $key is not seekable
+     * @return void
+     */
+    public function seek($key)
+    {
+        if ($key < 0 || $key >= $this->count()) {
+            $message = "Position '{$key}' is not seekable.";
+            throw new OutOfBoundsException($message);
+        }
+        $this->_key = $key;
+    }
+
+    /**
+     * Implement Iterator::key()
+     *
+     * @return integer
+     */
+    public function key()
+    {
+        return $this->_key;
+    }
+
+    /**
+     * Implement Iterator::next()
+     *
+     * @return void
+     */
+    public function next()
+    {
+        $this->_key++;
+    }
+
+    /**
+     * Implement Iterator::rewind()
+     *
+     * @return void
+     */
+    public function rewind()
+    {
+        $this->_key = 0;
+    }
+
+    /**
+     * Implement Iterator::valid()
+     *
+     * @return boolean
+     */
+    public function valid()
+    {
+        return $this->_key >= 0 && $this->_key < $this->count();
+    }
+
+    /**
+     * Implement Countable::current()
+     *
+     * @return integer
+     */
+    public function count()
+    {
+        return $this->_nodes ? $this->_nodes->length : 0;
+    }
+}

+ 131 - 0
library/Zend/Service/Ebay/Finding/ShippingInfo.php

@@ -0,0 +1,131 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: ShippingInfo.php 22791 2010-08-04 16:11:47Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_ShippingInfo extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * The basic shipping cost of the item.
+     *
+     * @var float
+     */
+    public $shippingServiceCost;
+
+    /**
+     * Currency in which the monetary amount is specified.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/currencyIdList.html
+     * @var  string
+     */
+    public $shippingServiceCost_currencyId;
+
+    /**
+     * The shipping method that was used for determining the cost of shipping.
+     *
+     * For example: flat rate, calculated, or free. The seller specifies the
+     * available shipping services when they list the item.
+     *
+     * Applicable values:
+     *
+     *     Calculated
+     *     The calculated shipping model: The posted cost of shipping is based
+     *     on the buyer-selected shipping service, chosen by the buyer from the
+     *     different shipping services offered by the seller. The shipping costs
+     *     are calculated by eBay and the shipping carrier, based on the buyer's
+     *     address. Any packaging and handling costs established by the seller
+     *     are automatically rolled into the total.
+     *
+     *     CalculatedDomesticFlatInternational
+     *     The seller specified one or more calculated domestic shipping
+     *     services and one or more flat international shipping services.
+     *
+     *     Flat
+     *     The flat-rate shipping model: The seller establishes the cost of
+     *     shipping and any shipping insurance, regardless of what any
+     *     buyer-selected shipping service might charge the seller.
+     *
+     *     FlatDomesticCalculatedInternational
+     *     The seller specified one or more flat domestic shipping services and
+     *     one or more calculated international shipping services.
+     *
+     *     Free
+     *     Free is used when the seller has declared that shipping is free for
+     *     the buyer.
+     *
+     *     FreePickup
+     *     No shipping available, the buyer must pick up the item from the
+     *     seller.
+     *
+     *     Freight
+     *     The freight shipping model: the cost of shipping is determined by a
+     *     third party, FreightQuote.com, based on the buyer's address (postal
+     *     code).
+     *
+     *     FreightFlat
+     *     The flat rate shipping model: the seller establishes the cost of
+     *     freight shipping and freight insurance, regardless of what any
+     *     buyer-selected shipping service might charge the seller.
+     *
+     *     NotSpecified
+     *     The seller did not specify the shipping type.
+     *
+     * @var string
+     */
+    public $shippingType;
+
+    /**
+     * An international location or region to which the seller is willing to
+     * ship the item.
+     *
+     * Returned only for items that have shipToLocations specified.
+     *
+     * @link http://developer.ebay.com/DevZone/finding/CallRef/Enums/shipToLocationList.html
+     * @var  string[]
+     */
+    public $shipToLocations;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->shippingServiceCost            = $this->_query(".//$ns:shippingServiceCost[1]", 'float');
+        $this->shippingServiceCost_currencyId = $this->_query(".//$ns:shippingServiceCost[1]/@currencyId[1]", 'string');
+        $this->shippingType                   = $this->_query(".//$ns:shippingType[1]", 'string');
+        $this->shipToLocations                = $this->_query(".//$ns:shipToLocations", 'string', true);
+    }
+}

+ 73 - 0
library/Zend/Service/Ebay/Finding/Storefront.php

@@ -0,0 +1,73 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Storefront.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * @see Zend_Service_Ebay_Finding_Abstract
+ */
+require_once 'Zend/Service/Ebay/Finding/Abstract.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service
+ * @subpackage Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @uses       Zend_Service_Ebay_Finding_Abstract
+ */
+class Zend_Service_Ebay_Finding_Storefront extends Zend_Service_Ebay_Finding_Abstract
+{
+    /**
+     * The name of the seller's eBay Store.
+     *
+     * @var string
+     */
+    public $storeName;
+
+    /**
+     * The URL of the seller's eBay Store page.
+     *
+     * @var string
+     */
+    public $storeURL;
+
+    /**
+     * @return void
+     */
+    protected function _init()
+    {
+        parent::_init();
+        $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING;
+
+        $this->storeName = $this->_query(".//$ns:storeName[1]", 'string');
+        $this->storeURL  = $this->_query(".//$ns:storeURL[1]", 'string');
+    }
+
+    /**
+     * @param  Zend_Service_Ebay_Finding $proxy
+     * @param  Zend_Config|array         $options
+     * @return Zend_Service_Ebay_Finding_Response_Items
+     */
+    public function findItems(Zend_Service_Ebay_Finding $proxy, $options = null)
+    {
+        return $proxy->findItemsInEbayStores($this->storeName, $options);
+    }
+}

+ 13 - 0
library/Zend/Tool/Project/Provider/Form.php

@@ -90,6 +90,19 @@ class Zend_Tool_Project_Provider_Form extends Zend_Tool_Project_Provider_Abstrac
         return $profile->search($profileSearchParams);
     }
     
+    public function enable($module = null)
+    {
+        $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
+
+        // determine if testing is enabled in the project
+        $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile);
+
+        if (self::hasResource($this->_loadedProfile, $name, $module)) {
+            throw new Zend_Tool_Project_Provider_Exception('This project already has a form named ' . $name);
+        }
+        
+    }
+    
     /**
      * Create a new form
      *

+ 6 - 0
tests/TestConfiguration.php.dist

@@ -597,6 +597,12 @@ define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN', 'ZF_Username');
 define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD', 'ZF_Password');
 
 /**
+ * Zend_Service_Ebay online tests
+ */
+define('TESTS_ZEND_SERVICE_EBAY_ONLINE_ENABLED', false);
+define('TESTS_ZEND_SERVICE_EBAY_ONLINE_APPID', 'Enter APPID here');
+
+/**
  * Zend_Service_Flickr online tests
  */
 define('TESTS_ZEND_SERVICE_FLICKR_ONLINE_ENABLED', false);

+ 205 - 0
tests/Zend/Service/Ebay/AbstractTest.php

@@ -0,0 +1,205 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: AbstractTest.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * Test helper
+ */
+require_once dirname(__FILE__) . '/../../../TestHelper.php';
+
+/**
+ * @see Zend_Service_Ebay_Abstract
+ */
+require_once dirname(__FILE__) . '/_files/Concrete.php';
+
+/**
+ * @see Zend_Config
+ */
+require_once 'Zend/Config.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_Ebay_AbstractTest extends PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Zend_Service_Ebay_AbstractConcrete
+     */
+    protected $_concrete;
+
+    protected function setUp()
+    {
+        $this->_concrete = new Zend_Service_Ebay_AbstractConcrete(array());
+    }
+
+    public function testConstructor()
+    {
+        $array  = array('foo'  => 'bar',
+                        'some' => 'value');
+        $config = new Zend_Config($array);
+
+        $concreteArray  = new Zend_Service_Ebay_AbstractConcrete($array);
+        $concreteConfig = new Zend_Service_Ebay_AbstractConcrete($config);
+
+        foreach (array_keys($array) as $option) {
+            $this->assertEquals($concreteArray->getOption($option), $concreteConfig->getOption($option));
+        }
+    }
+
+    public function testSetOptions()
+    {
+        $array  = array('foo'  => 'bar',
+                        'some' => 'value');
+        $config = new Zend_Config($array);
+        $concreteArray  = new Zend_Service_Ebay_AbstractConcrete();
+        $concreteArray->setOption($array);
+        $concreteConfig = new Zend_Service_Ebay_AbstractConcrete();
+        $concreteConfig->setOption($config);
+        foreach (array_keys($array) as $option) {
+            $this->assertEquals($concreteArray->getOption($option), $concreteConfig->getOption($option));
+        }
+
+        $this->assertNull($concreteArray->getOption('bar'));
+        $this->assertNull($concreteConfig->getOption('bar'));
+    }
+
+    public function testOptionsToArrayInvalid()
+    {
+        $this->setExpectedException('Zend_Service_Ebay_Exception');
+        Zend_Service_Ebay_Abstract::optionsToArray('invalid');
+    }
+
+    public function testGetOption()
+    {
+        $expected = array(
+            'foo' => 1,
+            'bar' => 2
+        );
+
+        $this->_concrete->setOption('foo', 1)
+                        ->setOption(array('bar' => 2));
+
+        $this->assertEquals(1, $this->_concrete->getOption('foo'));
+        $this->assertEquals(2, $this->_concrete->getOption('bar'));
+        $this->assertEquals($expected, $this->_concrete->getOption());
+
+        $this->_concrete->setOption(
+            array('foo' => 3,
+                  'bar' => 4
+            )
+        );
+        $this->assertEquals(3, $this->_concrete->getOption('foo'));
+        $this->assertEquals(4, $this->_concrete->getOption('bar'));
+    }
+
+    public function testHasOption()
+    {
+        $this->_concrete->setOption('foo', 1);
+        $this->assertTrue($this->_concrete->hasOption('foo'));
+        $this->assertFalse($this->_concrete->hasOption('bar'));
+    }
+
+    public function testToEbayValue()
+    {
+        $this->assertSame('1', Zend_Service_Ebay_AbstractConcrete::toEbayValue(true));
+        $this->assertSame('0', Zend_Service_Ebay_AbstractConcrete::toEbayValue(false));
+
+        require_once 'Zend/Date.php';
+        $date = new Zend_Date();
+        $this->assertSame($date->getIso(), Zend_Service_Ebay_AbstractConcrete::toEbayValue($date));
+
+        $date = new DateTime();
+        $this->assertSame($date->format(DateTime::ISO8601), Zend_Service_Ebay_AbstractConcrete::toEbayValue($date));
+
+        $this->assertSame('10', Zend_Service_Ebay_AbstractConcrete::toEbayValue(10));
+    }
+
+    public function testToPhpValue()
+    {
+        $this->assertSame('10', Zend_Service_Ebay_Abstract::toPhpValue(10, 'integer'));
+        $this->assertSame('foo', Zend_Service_Ebay_Abstract::toPhpValue('foo', 'string'));
+        $this->assertSame(10.5, Zend_Service_Ebay_Abstract::toPhpValue(10.5, 'float'));
+        $this->assertTrue(true, Zend_Service_Ebay_Abstract::toPhpValue('true', 'boolean'));
+    }
+
+    public function testToPhpValueInvalidType()
+    {
+        $this->setExpectedException('Zend_Service_Ebay_Exception');
+        Zend_Service_Ebay_Abstract::toPhpValue('value', 'invalid-type');
+    }
+
+    public function testOptionsToNameValueSyntax()
+    {
+        $options = array(
+            'paginationInput' => array(
+              'entriesPerPage' => 5,
+              'pageNumber'     => 2
+            ),
+            'itemFilter' => array(
+              array(
+                  'name'       => 'MaxPrice',
+                  'value'      => 25,
+                  'paramName'  => 'Currency',
+                  'paramValue' => 'USD'
+              ),
+              array(
+                  'name'  => 'FreeShippingOnly',
+                  'value' => true
+              ),
+              array(
+                  'name'  => 'ListingType',
+                  'value' => array(
+                      'AuctionWithBIN',
+                      'FixedPrice',
+                      'StoreInventory'
+                  )
+              )
+            ),
+            'productId' => array(
+              ''     => 123,
+              'type' => 'UPC'
+            )
+        );
+
+        $expected = array(
+            'paginationInput.entriesPerPage' => '5',
+            'paginationInput.pageNumber'     => '2',
+            'itemFilter(0).name'             => 'MaxPrice',
+            'itemFilter(0).value'            => '25',
+            'itemFilter(0).paramName'        => 'Currency',
+            'itemFilter(0).paramValue'       => 'USD',
+            'itemFilter(1).name'             => 'FreeShippingOnly',
+            'itemFilter(1).value'            => '1',
+            'itemFilter(2).name'             => 'ListingType',
+            'itemFilter(2).value(0)'         => 'AuctionWithBIN',
+            'itemFilter(2).value(1)'         => 'FixedPrice',
+            'itemFilter(2).value(2)'         => 'StoreInventory',
+            'productId'                      => '123',
+            'productId.@type'                => 'UPC'
+        );
+
+        $this->assertEquals($expected, $this->_concrete->optionsToNameValueSyntax($options));
+    }
+}

+ 66 - 0
tests/Zend/Service/Ebay/AllTests.php

@@ -0,0 +1,66 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: AllTests.php 22813 2010-08-08 14:34:42Z ramon $
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_Ebay_AllTests::main');
+}
+
+/**
+ * Test helper
+ */
+require_once dirname(__FILE__) . '/../../../TestHelper.php';
+
+/**
+ * @see Zend_Service_Ebay_AllTests
+ */
+require_once 'Zend/Service/Ebay/Finding/AllTests.php';
+
+/**
+ * @see Zend_Service_Ebay_AbstractTest
+ */
+require_once 'Zend/Service/Ebay/AbstractTest.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @group      Zend_Service
+ */
+class Zend_Service_Ebay_AllTests
+{
+    public static function main()
+    {
+        PHPUnit_TextUI_TestRunner::run(self::suite());
+    }
+
+    public static function suite()
+    {
+        $suite = new PHPUnit_Framework_TestSuite('Zend Framework - Zend_Service_Ebay');
+        $suite->addTestSuite('Zend_Service_Ebay_AbstractTest');
+        $suite->addTest(Zend_Service_Ebay_Finding_AllTests::suite());
+        return $suite;
+    }
+}
+if (PHPUnit_MAIN_METHOD == 'Zend_Service_Ebay_AllTests::main') {
+    Zend_Service_AllTests::main();
+}

+ 72 - 0
tests/Zend/Service/Ebay/Finding/AllTests.php

@@ -0,0 +1,72 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: AllTests.php 22783 2010-08-03 16:01:28Z ramon $
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Service_Ebay_Finding_AllTests::main');
+}
+
+/**
+ * Test helper
+ */
+require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+
+
+/**
+ * @see Zend_Service_Ebay_Finding_OfflineTest
+ */
+require_once 'Zend/Service/Ebay/Finding/OfflineTest.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding_OfflineTest
+ */
+require_once 'Zend/Service/Ebay/Finding/OnlineTest.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @group      Zend_Service
+ */
+class Zend_Service_Ebay_Finding_AllTests
+{
+    public static function main()
+    {
+        PHPUnit_TextUI_TestRunner::run(self::suite());
+    }
+
+    public static function suite()
+    {
+        $suite = new PHPUnit_Framework_TestSuite('Zend Framework - Zend_Service_Ebay');
+        $suite->addTestSuite('Zend_Service_Ebay_OfflineTest');
+        if (defined('TESTS_ZEND_SERVICE_EBAY_ONLINE_ENABLED') &&
+            constant('TESTS_ZEND_SERVICE_EBAY_ONLINE_ENABLED') !== false) {
+            $suite->addTestSuite('Zend_Service_Ebay_Finding_OnlineTest');
+        } else {
+            $suite->addTestSuite('Zend_Service_Ebay_Finding_OnlineSkipTest');
+        }
+        return $suite;
+    }
+}
+if (PHPUnit_MAIN_METHOD == 'Zend_Service_Ebay_Finding_AllTests::main') {
+    Zend_Service_AllTests::main();
+}

+ 370 - 0
tests/Zend/Service/Ebay/Finding/OfflineTest.php

@@ -0,0 +1,370 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: OfflineTest.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * Test helper
+ */
+require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding
+ */
+require_once 'Zend/Service/Ebay/Finding.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding_Response_Keywords
+ */
+require_once 'Zend/Service/Ebay/Finding/Response/Keywords.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding_Response_Items
+ */
+require_once 'Zend/Service/Ebay/Finding/Response/Items.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_Ebay_OfflineTest extends PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Zend_Service_Ebay_Finding
+     */
+    protected $_finding;
+
+    protected function setUp()
+    {
+        $this->_finding = new Zend_Service_Ebay_Finding('foo');
+    }
+
+    public function testClient()
+    {
+        $this->assertTrue($this->_finding->getClient() instanceof Zend_Rest_Client);
+
+        require_once dirname(__FILE__) . '/_files/ClientCustom.php';
+        $this->assertTrue($this->_finding->setClient(new ClientCustom()) instanceof Zend_Service_Ebay_Finding);
+        $this->assertTrue($this->_finding->getClient() instanceof ClientCustom);
+
+        $this->setExpectedException('Zend_Service_Ebay_Finding_Exception');
+        $this->_finding->setClient(new stdClass());
+    }
+
+    public function testConstructor()
+    {
+        $this->assertEquals('EBAY-US', $this->_finding->getOption(Zend_Service_Ebay_Finding::OPTION_GLOBAL_ID));
+        $this->assertEquals('foo', $this->_finding->getOption(Zend_Service_Ebay_Finding::OPTION_APP_ID));
+
+        $options = array(
+            Zend_Service_Ebay_Finding::OPTION_APP_ID    => 'app-id',
+            Zend_Service_Ebay_Finding::OPTION_GLOBAL_ID => 'EBAY-GB',
+            'foo' => 'bar'
+        );
+        $finding = new Zend_Service_Ebay_Finding($options);
+        $this->assertEquals('EBAY-GB', $finding->getOption(Zend_Service_Ebay_Finding::OPTION_GLOBAL_ID));
+        $this->assertEquals('app-id', $finding->getOption(Zend_Service_Ebay_Finding::OPTION_APP_ID));
+        $this->assertEquals('bar', $finding->getOption('foo'));
+
+        $this->setExpectedException('Zend_Service_Ebay_Finding_Exception');
+        $finding = new Zend_Service_Ebay_Finding(array('foo' => 'bar'));
+    }
+
+    public function testResponseAbstract()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/get-search-keywords-recomendation.xml');
+
+        // no error xml
+        $response = $this->_createResponseKeywords($xml);
+        $this->assertNotNull($response->ack);
+        $this->assertNotNull($response->timestamp);
+        $this->assertNotNull($response->version);
+    }
+
+    public function testErrorMessage()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/error.xml');
+
+        // xml with error inside
+        $response = $this->_createResponseKeywords($xml);
+        $this->assertNotNull($response->ack);
+        $this->assertNotNull($response->timestamp);
+        $this->assertNotNull($response->version);
+        $this->assertType('Zend_Service_Ebay_Finding_Error_Message', $response->errorMessage);
+
+        // Zend_Service_Ebay_Finding_Error_Message
+        $object = $response->errorMessage;
+        $this->assertType('Zend_Service_Ebay_Finding_Error_Data_Set', $object->error);
+
+        // Zend_Service_Ebay_Finding_Error_Data
+        $object = $object->error->current();
+        $this->assertNotNull($object->category);
+        $this->assertNotNull($object->domain);
+        $this->assertNotNull($object->errorId);
+        $this->assertNotNull($object->message);
+        $this->assertType('array', $object->parameter);
+        $this->assertType('array', $object->parameter_name);
+        $this->assertNotNull($object->severity);
+        $this->assertNotNull($object->subdomain);
+
+        // missing attributes in XML
+        //$this->assertNotNull($object->exceptionId);
+    }
+
+    public function testResponseKeywords()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/get-search-keywords-recomendation.xml');
+
+        $response = $this->_createResponseKeywords($xml);
+        $this->assertNotNull($response->keywords);
+    }
+
+    public function testResponseItems()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $this->assertType('Zend_Service_Ebay_Finding_PaginationOutput', $response->paginationOutput);
+        $this->assertType('Zend_Service_Ebay_Finding_Search_Result', $response->searchResult);
+        $this->assertNotNull($response->searchResult_count);
+    }
+
+    public function testPaginationOutput()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $object = $response->paginationOutput;
+        $this->assertNotNull($object->entriesPerPage);
+        $this->assertNotNull($object->pageNumber);
+        $this->assertNotNull($object->totalEntries);
+        $this->assertNotNull($object->totalPages);
+    }
+
+    public function testSearchResult()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $object = $response->searchResult;
+        $this->assertType('Zend_Service_Ebay_Finding_Search_Item_Set', $object->item);
+    }
+
+    public function testSearchItem()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        // general attributes
+        $response->searchResult->item->seek(0);
+        $object = $response->searchResult->item->current();
+        $this->assertType('Zend_Service_Ebay_Finding_Search_Item', $object);
+        $this->assertNotNull($object->autoPay);
+        $this->assertNotNull($object->country);
+        $this->assertType('array', $object->galleryPlusPictureURL);
+        $this->assertNotNull($object->galleryPlusPictureURL[0]);
+        $this->assertNotNull($object->galleryURL);
+        $this->assertNotNull($object->globalId);
+        $this->assertNotNull($object->itemId);
+        $this->assertType('Zend_Service_Ebay_Finding_ListingInfo', $object->listingInfo);
+        $this->assertNotNull($object->location);
+        $this->assertType('array', $object->paymentMethod);
+        $this->assertNotNull($object->paymentMethod[0]);
+        $this->assertNotNull($object->postalCode);
+        $this->assertType('Zend_Service_Ebay_Finding_Category', $object->primaryCategory);
+        $this->assertType('Zend_Service_Ebay_Finding_SellerInfo', $object->sellerInfo);
+        $this->assertType('Zend_Service_Ebay_Finding_SellingStatus', $object->sellingStatus);
+        $this->assertType('Zend_Service_Ebay_Finding_ShippingInfo', $object->shippingInfo);
+        $this->assertType('Zend_Service_Ebay_Finding_Storefront', $object->storeInfo);
+        $this->assertNotNull($object->title);
+        $this->assertNotNull($object->viewItemURL);
+
+        // product id
+        $response->searchResult->item->seek(3);
+        $object = $response->searchResult->item->current();
+        $this->assertNotNull($object->productId);
+        $this->assertNotNull($object->productId_type);
+
+        // sub category
+        $response->searchResult->item->seek(2);
+        $object = $response->searchResult->item->current();
+        $this->assertType('Zend_Service_Ebay_Finding_Category', $object->secondaryCategory);
+
+        // missing attributes in XML
+        //$this->assertNotNull($object->charityId);
+        //$this->assertNotNull($object->distance);
+        //$this->assertNotNull($object->distance_unit);
+    }
+
+    public function testListingInfo()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $response->searchResult->item->seek(4);
+        $object = $response->searchResult->item->current()->listingInfo;
+        $this->assertNotNull($object->bestOfferEnabled);
+        $this->assertNotNull($object->buyItNowAvailable);
+        $this->assertNotNull($object->buyItNowPrice);
+        $this->assertNotNull($object->buyItNowPrice_currencyId);
+        $this->assertNotNull($object->convertedBuyItNowPrice);
+        $this->assertNotNull($object->convertedBuyItNowPrice_currencyId);
+        $this->assertNotNull($object->endTime);
+        $this->assertNotNull($object->gift);
+        $this->assertNotNull($object->listingType);
+        $this->assertNotNull($object->startTime);
+    }
+
+    public function testCategory()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $response->searchResult->item->seek(0);
+        $object = $response->searchResult->item->current()->primaryCategory;
+        $this->assertNotNull($object->categoryId);
+        $this->assertNotNull($object->categoryName);
+    }
+
+    public function testSellerInfo()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $response->searchResult->item->seek(0);
+        $object = $response->searchResult->item->current()->sellerInfo;
+        $this->assertNotNull($object->feedbackRatingStar);
+        $this->assertNotNull($object->feedbackScore);
+        $this->assertNotNull($object->positiveFeedbackPercent);
+        $this->assertNotNull($object->sellerUserName);
+        $this->assertNotNull($object->topRatedSeller);
+    }
+
+    public function testSellingStatus()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $response->searchResult->item->seek(1);
+        $object = $response->searchResult->item->current()->sellingStatus;
+        $this->assertNotNull($object->bidCount);
+        $this->assertNotNull($object->convertedCurrentPrice);
+        $this->assertNotNull($object->convertedCurrentPrice_currencyId);
+        $this->assertNotNull($object->currentPrice);
+        $this->assertNotNull($object->currentPrice_currencyId);
+        $this->assertNotNull($object->sellingState);
+        $this->assertNotNull($object->timeLeft);
+    }
+
+    public function testShippingInfo()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $response->searchResult->item->seek(0);
+        $object = $response->searchResult->item->current()->shippingInfo;
+        $this->assertNotNull($object->shippingServiceCost);
+        $this->assertNotNull($object->shippingServiceCost_currencyId);
+        $this->assertNotNull($object->shippingType);
+        $this->assertType('array', $object->shipToLocations);
+        $this->assertNotNull($object->shipToLocations[0]);
+    }
+
+    public function testStorefront()
+    {
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/find-items-advanced.xml');
+        $response = $this->_createResponseItems($xml);
+
+        $response->searchResult->item->seek(0);
+        $object = $response->searchResult->item->current()->storeInfo;
+        $this->assertNotNull($object->storeName);
+        $this->assertNotNull($object->storeURL);
+    }
+
+    public function testResponseHistogramAspect()
+    {
+        // test histogram aspect
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/histogram-aspect.xml');
+        $response = $this->_createResponseHistograms($xml);
+
+        $this->assertNotNull($response->aspectHistogramContainer);
+        $this->assertType('Zend_Service_Ebay_Finding_Aspect_Histogram_Container', $response->aspectHistogramContainer);
+        $this->assertNull($response->categoryHistogramContainer);
+
+        // Zend_Service_Ebay_Finding_Aspect_Set
+        $object = $response->aspectHistogramContainer;
+        $this->assertType('Zend_Service_Ebay_Finding_Aspect_Set', $object->aspect);
+
+        // Zend_Service_Ebay_Finding_Aspect
+        $object = $object->aspect->current();
+        $this->assertType('Zend_Service_Ebay_Finding_Aspect_Histogram_Value_Set', $object->valueHistogram);
+        $this->assertType('array', $object->valueHistogram_valueName);
+
+        // Zend_Service_Ebay_Finding_Aspect_Histogram_Value
+        $object = $object->valueHistogram->current();
+        $this->assertNotNull($object->count);
+    }
+
+    public function testResponseHistogramCategory()
+    {
+        // test histogram aspect
+        $xml = file_get_contents(dirname(__FILE__) . '/_files/histogram-category.xml');
+        $response = $this->_createResponseHistograms($xml);
+
+        $this->assertNotNull($response->categoryHistogramContainer);
+        $this->assertType('Zend_Service_Ebay_Finding_Category_Histogram_Container', $response->categoryHistogramContainer);
+        $this->assertNull($response->aspectHistogramContainer);
+
+        // Zend_Service_Ebay_Finding_Category_Histogram_Container
+        $object = $response->categoryHistogramContainer;
+        $this->assertType('Zend_Service_Ebay_Finding_Category_Histogram_Set', $object->categoryHistogram);
+
+        // Zend_Service_Ebay_Finding_Category_Histogram
+        $object = $object->categoryHistogram->current();
+        $this->assertType('Zend_Service_Ebay_Finding_Category_Histogram', $object);
+        $this->assertType('Zend_Service_Ebay_Finding_Category_Histogram_Set', $object->childCategoryHistogram);
+        $this->assertNotNull($object->count);
+    }
+
+    protected function _readXML($xml)
+    {
+        $dom = new DOMDocument();
+        $dom->loadXML($xml);
+        return $dom;
+    }
+
+    protected function _createResponseItems($xml)
+    {
+        return new Zend_Service_Ebay_Finding_Response_Items($this->_readXML($xml)->firstChild);
+    }
+
+    protected function _createResponseHistograms($xml)
+    {
+        return new Zend_Service_Ebay_Finding_Response_Histograms($this->_readXML($xml)->firstChild);
+    }
+
+    protected function _createResponseKeywords($xml)
+    {
+        return new Zend_Service_Ebay_Finding_Response_Keywords($this->_readXML($xml)->firstChild);
+    }
+}

+ 189 - 0
tests/Zend/Service/Ebay/Finding/OnlineTest.php

@@ -0,0 +1,189 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: OnlineTest.php 22824 2010-08-09 18:59:54Z renanbr $
+ */
+
+/**
+ * Test helper
+ */
+require_once dirname(__FILE__) . '/../../../../TestHelper.php';
+
+/**
+ * @see Zend_Service_Ebay_Finding
+ */
+require_once 'Zend/Service/Ebay/Finding.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Service_Ebay_Finding_OnlineTest extends PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Zend_Service_Ebay_Finding
+     */
+    protected $_finding;
+
+    protected function setUp()
+    {
+        $this->_finding = new Zend_Service_Ebay_Finding(constant('TESTS_ZEND_SERVICE_EBAY_ONLINE_APPID'));
+    }
+
+    public function testInvalidAppId()
+    {
+        $this->_finding->setOption(Zend_Service_Ebay_Abstract::OPTION_APP_ID, 'foo');
+        $appId = $this->_finding->getOption(Zend_Service_Ebay_Abstract::OPTION_APP_ID);
+        $this->assertEquals('foo', $appId);
+        try {
+            $response = $this->_finding->findItemsByKeywords('harry+potter');
+            $this->fail('No exception found');
+        } catch (Exception $e) {
+            $this->assertType('Zend_Service_Ebay_Finding_Exception', $e);
+            $this->assertContains('eBay error', $e->getMessage());
+        }
+    }
+
+    public function testResponseTypeFinds()
+    {
+        $services =  array('findItemsAdvanced'     => array('tolkien'),
+                           'findItemsByCategory'   => array('10181'),
+                           'findItemsByKeywords'   => array('harry+potter'),
+                           'findItemsByProduct'    => array('53039031'),
+                           'findItemsInEbayStores' => array("Laura_Chen's_Small_Store"));
+
+        $item     = null;
+        $category = null;
+        $store    = null;
+        foreach ($services as $service => $params) {
+            $response = call_user_func_array(array($this->_finding, $service), $params);
+            $this->assertTrue($response instanceof Zend_Service_Ebay_Finding_Response_Items);
+            if (!$item && $response->searchResult_count > 0) {
+                $item = $response->searchResult->item->current();
+            }
+            if (!$category && $response->searchResult_count > 0) {
+                foreach ($response->searchResult->item as $node) {
+                    if ($node->primaryCategory) {
+                        $category = $node->primaryCategory;
+                    }
+                }
+            }
+            if (!$store && $response->searchResult_count > 0) {
+                foreach ($response->searchResult->item as $node) {
+                    if ($node->storeInfo) {
+                        $store = $node->storeInfo;
+                    }
+                }
+            }
+        }
+
+        $response2 = $item->findItemsByProduct($this->_finding);
+        $this->assertTrue($response2 instanceof Zend_Service_Ebay_Finding_Response_Items);
+
+        $response3 = $category->findItems($this->_finding, array());
+        $this->assertTrue($response3 instanceof Zend_Service_Ebay_Finding_Response_Items);
+
+        $response4 = $store->findItems($this->_finding, array());
+        $this->assertTrue($response4 instanceof Zend_Service_Ebay_Finding_Response_Items);
+    }
+
+    public function testResponseTypeGets()
+    {
+        $response = $this->_finding->getSearchKeywordsRecommendation('hary');
+        $this->assertTrue($response instanceof Zend_Service_Ebay_Finding_Response_Keywords);
+
+        $response2 = $response->findItems($this->_finding, array());
+        $this->assertTrue($response2 instanceof Zend_Service_Ebay_Finding_Response_Items);
+
+        $response3 = $this->_finding->getHistograms('11233');
+        $this->assertTrue($response3 instanceof Zend_Service_Ebay_Finding_Response_Histograms);
+    }
+
+    public function testItemsPagination()
+    {
+        // page 1
+        // make sure this search will generate more than one page as result
+        $page1 = $this->_finding->findItemsByKeywords('laptop');
+        $this->assertEquals(1, $page1->paginationOutput->pageNumber);
+
+        // out of range, page #0
+        try {
+            $page1->page($this->_finding, 0);
+            $this->fail('No exception found for page #0');
+        } catch (Exception $e) {
+            $this->assertType('Zend_Service_Ebay_Finding_Exception', $e);
+            $this->assertContains('Page number ', $e->getMessage());
+        }
+
+        // out of range, one page after last one
+        try {
+            $number = $page1->paginationOutput->totalPages + 1;
+            $page1->page($this->_finding, $number);
+            $this->fail("No exception found for page out of range #$number");
+        } catch (Exception $e) {
+            $this->assertType('Zend_Service_Ebay_Finding_Exception', $e);
+            $this->assertContains('Page number ', $e->getMessage());
+        }
+
+        // page next
+        $page2 = $page1->pageNext($this->_finding);
+        $this->assertEquals(2, $page2->paginationOutput->pageNumber);
+
+        // previous
+        $previous = $page2->pagePrevious($this->_finding);
+        $this->assertEquals(1, $previous->paginationOutput->pageNumber);
+        $this->assertNull($page1->pagePrevious($this->_finding));
+
+        // first
+        $first = $page2->pageFirst($this->_finding);
+        $this->assertEquals(1, $first->paginationOutput->pageNumber);
+
+        // last
+        $last = $page2->pageLast($this->_finding);
+        $this->assertNotEquals(1, $last->paginationOutput->pageNumber);
+
+        // page #2
+        $some = $page1->page($this->_finding, 2);
+        $this->assertEquals(2, $some->paginationOutput->pageNumber);
+    }
+}
+
+/**
+ * @category   Zend
+ * @package    Zend_Service_Ebay
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @group      Zend_Service
+ * @group      Zend_Service_Ebay
+ */
+class Zend_Service_Ebay_Finding_OnlineSkipTest extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        $this->markTestSkipped('Zend_Service_Ebay online tests not enabled with an APPID in TestConfiguration.php');
+    }
+
+    public function testNothing()
+    {
+    }
+}

+ 3 - 0
tests/Zend/Service/Ebay/Finding/_files/ClientCustom.php

@@ -0,0 +1,3 @@
+<?php
+class ClientCustom extends Zend_Rest_Client
+{}

+ 1 - 0
tests/Zend/Service/Ebay/Finding/_files/error.xml

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><getSearchKeywordsRecommendationResponse xmlns="http://www.ebay.com/marketplace/search/v1/services"><ack>Warning</ack><errorMessage><error><errorId>59</errorId><domain>Marketplace</domain><severity>Warning</severity><category>Request</category><message>No recommendation was identified for the submitted keywords.</message><subdomain>Search</subdomain></error></errorMessage><version>1.5.0</version><timestamp>2010-08-08T13:53:40.888Z</timestamp><keywords/></getSearchKeywordsRecommendationResponse>

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
tests/Zend/Service/Ebay/Finding/_files/find-items-advanced.xml


+ 1 - 0
tests/Zend/Service/Ebay/Finding/_files/get-search-keywords-recomendation.xml

@@ -0,0 +1 @@
+<?xml version='1.0' encoding='UTF-8'?><getSearchKeywordsRecommendationResponse xmlns="http://www.ebay.com/marketplace/search/v1/services"><ack>Success</ack><version>1.5.0</version><timestamp>2010-08-04T14:44:28.460Z</timestamp><keywords>harry</keywords></getSearchKeywordsRecommendationResponse>

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
tests/Zend/Service/Ebay/Finding/_files/histogram-aspect.xml


+ 1 - 0
tests/Zend/Service/Ebay/Finding/_files/histogram-category.xml

@@ -0,0 +1 @@
+<?xml version='1.0' encoding='UTF-8'?><getHistogramsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services"><ack>Success</ack><version>1.5.0</version><timestamp>2010-08-08T14:49:15.430Z</timestamp><categoryHistogramContainer><categoryHistogram><categoryId>18793</categoryId><categoryName>Software</categoryName><count>165174</count><childCategoryHistogram><categoryId>80327</categoryId><categoryName>Games &amp; Entertainment</categoryName><count>36379</count></childCategoryHistogram><childCategoryHistogram><categoryId>158911</categoryId><categoryName>System Utilities &amp; Maintenance</categoryName><count>27276</count></childCategoryHistogram><childCategoryHistogram><categoryId>3783</categoryId><categoryName>Education &amp; Reference</categoryName><count>26001</count></childCategoryHistogram><childCategoryHistogram><categoryId>3768</categoryId><categoryName>Business &amp; Productivity</categoryName><count>17017</count></childCategoryHistogram><childCategoryHistogram><categoryId>41870</categoryId><categoryName>Children's Software</categoryName><count>14228</count></childCategoryHistogram><childCategoryHistogram><categoryId>41859</categoryId><categoryName>Graphics &amp; Multimedia</categoryName><count>11073</count></childCategoryHistogram><childCategoryHistogram><categoryId>182</categoryId><categoryName>Other</categoryName><count>7355</count></childCategoryHistogram><childCategoryHistogram><categoryId>3792</categoryId><categoryName>Apple Software</categoryName><count>5444</count></childCategoryHistogram><childCategoryHistogram><categoryId>3805</categoryId><categoryName>Antivirus &amp; Security</categoryName><count>4961</count></childCategoryHistogram><childCategoryHistogram><categoryId>11226</categoryId><categoryName>Operating Systems</categoryName><count>4555</count></childCategoryHistogram></categoryHistogram></categoryHistogramContainer></getHistogramsResponse>

+ 39 - 0
tests/Zend/Service/Ebay/_files/Concrete.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * @see Zend_Service_Ebay_Abstract
+ */
+require_once 'Zend/Service/Ebay/Abstract.php';
+
+class Zend_Service_Ebay_AbstractConcrete extends Zend_Service_Ebay_Abstract
+{
+    /**
+     * Does nothing
+     * Required by the Zend_Service_Ebay_Abstract
+     *
+     * @param mixed
+     */
+    public function setClient($client)
+    {
+    }
+
+    /**
+     * Does nothing
+     * Required by the Zend_Service_Ebay_Abstract
+     *
+     * @return void
+     */
+    public function getClient()
+    {
+    }
+
+    /**
+     * Proxy to Zend_Service_Ebay_Abstract::_optionsToNameValueSyntax
+     *
+     * @param array|Zend_Config $options
+     * @return array
+     */
+    public function optionsToNameValueSyntax($options)
+    {
+        return $this->_optionsToNameValueSyntax($options);
+    }
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов