Example #1
0
 /**
  * Returns the URL used for login. 
  * 
  * @param string
  * @return string
  */
 public function getLoginUrl($redirect)
 {
     //Argument 1 must be a string
     Eden_Getsatisfaction_Error::i()->argument(1, 'string');
     //get the token
     $token = Eden_Oauth::i()->consumer(self::REQUEST_URL, $this->_key, $this->_secret)->useAuthorization()->setMethodToPost()->setSignatureToHmacSha1()->getQueryResponse();
     //to avoid any unesissary usage of persistent data,
     //we are going to attach the secret to the login URL
     $secret = self::SECRET_KEY . '=' . $token['oauth_token_secret'];
     //determine the conector
     $connector = NULL;
     //if there is no question mark
     if (strpos($redirect, '?') === false) {
         $connector = '?';
         //if the redirect doesn't end with a question mark
     } else {
         if (substr($redirect, -1) != '?') {
             $connector = '&';
         }
     }
     //now add the secret to the redirect
     $redirect .= $connector . $secret;
     //build the query
     $query = array('oauth_token' => $token['oauth_token'], 'oauth_callback' => $redirect);
     $query = http_build_query($query);
     return self::AUTHORIZE_URL . '?' . $query;
 }
 public function __construct($consumerKey, $consumerSecret, $accessToken, $accessSecret)
 {
     //argument test
     Eden_Getsatisfaction_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'string');
     //Argument 4 must be a string
     $this->_consumerKey = $consumerKey;
     $this->_consumerSecret = $consumerSecret;
     $this->_accessToken = $accessToken;
     $this->_accessSecret = $accessSecret;
 }
Example #3
0
 /**
  * Set range
  *
  * @param int
  * @return this
  */
 public function setRange($limit = 10)
 {
     Eden_Getsatisfaction_Error::i()->argument(1, 'int');
     if ($limit < 0) {
         $limit = 10;
     }
     $this->_query['limit'] = $limit;
     return $this;
 }
Example #4
0
 /**
  * Returns Getsatisfaction Topics
  *
  * @param string
  * @param string
  * @param string
  * @param string
  * @return Eden_Getsatisfaction_Topic
  */
 public function topic($consumerKey, $consumerSecret, $accessToken, $accessSecret)
 {
     Eden_Getsatisfaction_Error::i()->argument(1, 'string')->argument(2, 'string')->argument(3, 'string')->argument(4, 'string');
     return Eden_Getsatisfaction_Topic::i($consumerKey, $consumerSecret, $accessToken, $accessSecret);
 }
Example #5
0
 /**
  * Set topic intensity
  *
  * @param int 0-5
  * @return this
  */
 public function setIntensity($intensity)
 {
     Eden_Getsatisfaction_Error::i()->argument(1, 'int');
     if ($intensity < 0) {
         $intensity = 0;
     } else {
         if ($intensity > 5) {
             $intensity = 5;
         }
     }
     $this->_query['emotitag']['intensity'] = $intensity;
     return $this;
 }
Example #6
0
 /**
  * Updates the post
  *
  * @param string|int
  * @return array
  */
 public function update($topic)
 {
     Eden_Getsatisfaction_Error::i()->argument(1, 'string', 'numeric');
     $url = sprintf(Eden_GetSatisfaction_Detail::URL, $topic);
     return $this->_post($url, array('topic' => $this->_query), true);
 }
Example #7
0
 /**
  * Returns topic details
  *
  * @param string|int
  * @return array
  */
 public function getTopic($topic)
 {
     Eden_Getsatisfaction_Error::i()->argument(1, 'string', 'int');
     return $this->_getResponse(sprintf(self::URL, $topic));
 }
Example #8
0
 /**
  * Sets company URL
  *
  * @param string|int
  * @return this
  */
 public function setUser($user)
 {
     Eden_Getsatisfaction_Error::i()->argument(1, 'string', 'int');
     $this->_url = sprintf(self::URL_PEOPLE, $user);
     return $this;
 }