예제 #1
0
 /**
  * Make the request
  *
  * @param string $type
  * @param array $options
  * @return ApiResult
  */
 protected function makeRequest($type, $options)
 {
     $request = $this->requestFactory->create($type, ['key' => $this->apiKey] + $options);
     // Attempt load from cache
     if (isset($this->cache)) {
         $result = $this->cache->fetch($request);
     }
     // Make request if not in cache
     if (!isset($result)) {
         $rawResponse = $this->makeHttpRequest($request);
         $formattedResponse = $this->responseParser->parseResult($request, $rawResponse);
         $result = $this->resultFactory->create($formattedResponse);
     }
     // Save to cache
     if (isset($this->cache)) {
         $this->cache->cache($request, $result);
     }
     return $result;
 }
예제 #2
0
 public function testCreate()
 {
     $this->instance->create(Type::TYPE_DOMAIN_RANKS, ['key' => 'a key', 'domain' => 'domain.com']);
 }