setAccessKey() public method

Sets the accesskey
public setAccessKey ( string $accessKey ) : GenericConfiguration
$accessKey string
return GenericConfiguration
 public function testGettersAndSetters()
 {
     $this->genericConfiguration->setAccessKey('ABC');
     $this->genericConfiguration->setSecretKey('DEF');
     $this->genericConfiguration->setAssociateTag('GHI');
     $this->assertSame('ABC', $this->genericConfiguration->getAccessKey());
     $this->assertSame('DEF', $this->genericConfiguration->getSecretKey());
     $this->assertSame('GHI', $this->genericConfiguration->getAssociateTag());
 }
Ejemplo n.º 2
0
 public function testGettersAndSetters()
 {
     $object = new GenericConfiguration();
     $object->setAccessKey('ABC');
     $object->setSecretKey('DEF');
     $object->setAssociateTag('GHI');
     $object->setResponseTransformer($a = new XmlToDomDocument());
     $object->setRequest($b = new GuzzleRequest($this->prophesize('\\GuzzleHttp\\ClientInterface')->reveal()));
     $this->assertSame('ABC', $object->getAccessKey());
     $this->assertSame('DEF', $object->getSecretKey());
     $this->assertSame('GHI', $object->getAssociateTag());
     $this->assertSame($a, $object->getResponseTransformer());
     $this->assertSame($b, $object->getRequest());
 }
Ejemplo n.º 3
0
 /**
  * Builds a new ApaiIO instance
  *
  * @param array $config The configuration
  *
  * @return \ApaiIO\ApaiIO
  */
 public static function get($config)
 {
     $configuration = new GenericConfiguration();
     $configuration->setAccessKey($config['accesskey'])->setSecretKey($config['secretkey'])->setAssociateTag($config['associatetag'])->setCountry($config['country']);
     // Setting the default request-type if it has been setted up
     if (true === isset($config['request'])) {
         $configuration->setRequest($config['request']);
     }
     // Setting the default responsetransformer if it has been setted up
     if (true === isset($config['response'])) {
         $configuration->setResponseTransformer($config['response']);
     }
     return new ApaiIO($configuration);
 }
 /**
  * ApaiIOWrapper constructor.
  * @param array $apiConfig
  */
 public function __construct($apiConfig = array())
 {
     $client = new Client();
     $this->configuration = new GenericConfiguration();
     $this->configuration->setAccessKey($apiConfig['AWS_API_KEY'])->setSecretKey($apiConfig['AWS_API_SECRET_KEY'])->setAssociateTag($apiConfig['AWS_ASSOCIATE_TAG'])->setRequest(new \ApaiIO\Request\GuzzleRequest($client));
 }
Ejemplo n.º 5
0
 public function testSchemeSwitch()
 {
     $body = $this->prophesize('\\Psr\\Http\\Message\\StreamInterface');
     $body->getContents()->shouldBeCalledTimes(1)->willReturn('ABC');
     $response = $this->prophesize('\\Psr\\Http\\Message\\ResponseInterface');
     $response->getBody()->shouldBeCalledTimes(1)->willReturn($body->reveal());
     $client = $this->prophesize('\\GuzzleHttp\\ClientInterface');
     $client->send(Argument::that(function ($request) {
         if (!$request instanceof RequestInterface) {
             return false;
         }
         $uri = $request->getUri();
         $this->assertSame('https', $uri->getScheme());
         return true;
     }))->shouldBeCalledTimes(1)->willReturn($response->reveal());
     $request = new GuzzleRequest($client->reveal());
     $request->setScheme('HTTPS');
     $operation = new Lookup();
     $operation->setItemId('1');
     $config = new GenericConfiguration();
     $config->setAccessKey('abc');
     $config->setAssociateTag('def');
     $config->setCountry('DE');
     $config->setSecretKey('ghi');
     $config->setAccessKey('jkl');
     $request->perform($operation, $config);
 }