Example #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;
 }
Example #2
0
 public function testHasParameter()
 {
     $request = new Request(array('param1' => 'foo', 'param2' => 'bar'));
     $this->assertTrue($request->hasParameter('param1'));
     $this->assertTrue($request->hasParameter('param2'));
     $this->assertFalse($request->hasParameter('param3'));
     $this->assertFalse($request->hasParameter('param4'));
 }