Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 public function testSign()
 {
     $request = new Request(array('param1' => 'foo', 'param2' => 'bar'));
     $this->assertFalse($request->isSigned());
     $request->sign('sdfasf345345');
     $this->assertTrue($request->isSigned());
     $this->assertEquals(32, strlen($request->getParameter('api_sig')));
 }