/** * Create request object * @param string $method * @param array $params * @return Request */ public function createRequest($method, $params) { $request = new Request($params); $request->setParameter('method', $method); $request->setParameter('format', 'json'); if (false === $request->hasParameter('api_key')) { $request->setParameter('api_key', $this->getRtm()->getApiKey()); } if (false === $request->hasParameter('auth_token')) { $request->setParameter('auth_token', $this->getRtm()->getAuthToken()); } $request->sign($this->getRtm()->getSecret()); return $request; }
public function testGetServiceUrl() { $request = new Request(array('param1' => 'foo', 'param2' => 'bar')); $this->assertEquals(Rtm::URL_SERVICE, substr($request->getServiceUrl(), 0, strlen(Rtm::URL_AUTH))); $this->assertEquals('param1=foo¶m2=bar', parse_url($request->getServiceUrl(), PHP_URL_QUERY)); }