private function _lookUpBy($service, $data)
        {
            $batch = false;
            $urlFormat = self::$URLS[$service];

            if (is_array($data)) {
                $data = implode(',', $data);
                $batch = true;
            }

            $url = self::BASE_URL . sprintf($urlFormat, urlencode($data)) . sprintf(self::API_KEY, $this->_apiKey);

            $this->_client->setUri($url);

            $request = $this->_client->request();
            $data = json_decode($request->getBody(), true);

            if ($request->getStatus() == self::TRY_AGAIN_LATER_CODE || $request->getStatus() == self::NOT_FOUND_CODE) {
                throw new \Thin\Exception(
                    $data['message'], $data['status']
                );
            } else if ($request->getStatus() == 400) {
                throw new \Thin\Exception(
                    $data['message'], $data['status']
                );
            } else if (!$request->isSuccessful()) {
                throw new \Thin\Exception($request->getBody());
            }

            if ($batch) {
                return new \Thin\Html\Qwerly\Batch($data);
            } else {
                return new \Thin\Html\Qwerly\User($data);
            }
        }
private function _lookUpBy($service, $data)
        {
            $batch = false;
            $urlFormat = self::$URLS[$service];

            if (is_array($data)) {
                $data = implode(',', $data);
                $batch = true;
            }

            $url = self::BASE_URL . sprintf($urlFormat, urlencode($data)) . sprintf(self::API_KEY, $this->_apiKey);

            $this->_client->setUri($url);

            $request = $this->_client->request();
            $data = json_decode($request->getBody(), true);

            if ($request->getStatus() == self::TRY_AGAIN_LATER_CODE || $request->getStatus() == self::NOT_FOUND_CODE) {
                throw new \Thin\Exception(
                    $data['message'], $data['status']
                );
            } else if ($request->getStatus() == 400) {
                throw new \Thin\Exception(
                    $data['message'], $data['status']
                );
            } else if (!$request->isSuccessful()) {
                throw new \Thin\Exception($request->getBody());
            }

            if ($batch) {
                return new \Thin\Html\Qwerly\Batch($data);
            } else {
                return new \Thin\Html\Qwerly\User($data);
            }
        }
private function _lookUpBy ( $ service , $ data ) { $ batch = false ; $ urlFormat = self :: $ URLS [ $ service ] ; if ( is_array ( $ data ) ) { $ data = implode ( ',' , $ data ) ; $ batch = true ; } $ url = self :: BASE_URL . sprintf ( $ urlFormat , urlencode ( $ data ) ) . sprintf ( self :: API_KEY , $ this -> _apiKey ) ; $ this -> _client -> setUri ( $ url ) ; $ request = $ this -> _client -> request ( ) ; $ data = json_decode ( $ request -> getBody ( ) , true ) ; if ( $ request -> getStatus ( ) == self :: TRY_AGAIN_LATER_CODE || $ request -> getStatus ( ) == self :: NOT_FOUND_CODE ) { throw new \ Thin \ Exception ( $ data [ 'message' ] , $ data [ 'status' ] ) ; } else if ( $ request -> getStatus ( ) == 400 ) { throw new \ Thin \ Exception ( $ data [ 'message' ] , $ data [ 'status' ] ) ; } else if ( ! $ request -> isSuccessful ( ) ) { throw new \ Thin \ Exception ( $ request -> getBody ( ) ) ; } if ( $ batch ) { return new \ Thin \ Html \ Qwerly \ Batch ( $ data ) ; } else { return new \ Thin \ Html \ Qwerly \ User ( $ data ) ; } }
Looks up an user using the given service data.

@param string $service Service to look up with.
@param mixed $data Data relevant to the service.
@return Qwerly_API_Response|null
@throws Qwerly_API_ErrorException
@throws Qwerly_API_NotFoundException
Looks up an user using the given service data .