Mage_GoogleBase_Model_Service Class Reference

Inheritance diagram for Mage_GoogleBase_Model_Service:

Varien_Object Mage_GoogleBase_Model_Service_Feed Mage_GoogleBase_Model_Service_Item

List of all members.

Public Member Functions

 getClient ($storeId=null, $loginToken=null, $loginCaptcha=null)
 getService ($storeId=null)
 getGuestService ()
 getConfig ()
 getDryRun ()

Protected Member Functions

 _connect ($storeId=null)


Detailed Description

Definition at line 34 of file Service.php.


Member Function Documentation

_connect ( storeId = null  )  [protected]

Authorize Google Account

Returns:
Zend_Gdata_Gbase

Definition at line 100 of file Service.php.

00101     {
00102         $client = $this->getClient($storeId);
00103         $service = new Zend_Gdata_Gbase($client);
00104         return $service;
00105     }

getClient ( storeId = null,
loginToken = null,
loginCaptcha = null 
)

Retutn Google Base Client Instance

Returns:
Zend_Http_Client

Definition at line 41 of file Service.php.

00042     {
00043         $user = $this->getConfig()->getAccountLogin($storeId);
00044         $pass = $this->getConfig()->getAccountPassword($storeId);
00045 
00046         // Create an authenticated HTTP client
00047         $errorMsg = Mage::helper('googlebase')->__('Unable to connect to Google Base. Please, check Account settings in configuration.');
00048         try {
00049             $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, Zend_Gdata_Gbase::AUTH_SERVICE_NAME, null, '', $loginToken, $loginCaptcha);
00050         } catch (Zend_Gdata_App_CaptchaRequiredException $e) {
00051             throw $e;
00052         } catch (Zend_Gdata_App_HttpException $e) {
00053             Mage::throwException($errorMsg . Mage::helper('googlebase')->__('Error: %s', $e->getMessage()));
00054         } catch (Zend_Gdata_App_AuthException $e) {
00055             Mage::throwException($errorMsg . Mage::helper('googlebase')->__('Error: %s', $e->getMessage()));
00056         }
00057 
00058         return $client;
00059     }

getConfig (  ) 

Google Base Config

Returns:
Mage_GoogleBase_Model_Config

Definition at line 90 of file Service.php.

00091     {
00092         return Mage::getSingleton('googlebase/config');
00093     }

getDryRun (  ) 

Get Dry Run mode

Returns:
boolean

Definition at line 112 of file Service.php.

00113     {
00114         return $this->getDataSetDefault('dry_run', false);
00115     }

getGuestService (  ) 

Retutn Google Base Anonymous Client Instance

Returns:
Zend_Gdata_Gbase

Definition at line 80 of file Service.php.

00081     {
00082         return new Zend_Gdata_Gbase(new Zend_Http_Client());
00083     }

getService ( storeId = null  ) 

Retutn Google Base Service Instance

Returns:
Zend_Gdata_Gbase

Reimplemented in Mage_GoogleBase_Model_Service_Item.

Definition at line 66 of file Service.php.

00067     {
00068         if (!$this->_service) {
00069             $service = $this->_connect($storeId);
00070             $this->_service = $service;
00071         }
00072         return $this->_service;
00073     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:15 2009 for Magento by  doxygen 1.5.8