Example #1
0
 /**
  * Construct KWAPI Class
  * @param KWApi\Models\Credential $credential  API credential
  */
 public function __construct(Credential $credential)
 {
     // Ensure Endpoint from Credential object and override main endpoint when it not null
     if ($credential->getEndPoint() != null) {
         $this->endPoint = $credential->getEndPoint();
     }
     $this->httpClient = new HttpClient(['base_uri' => $this->endPoint]);
     $this->credential = $credential;
 }
Example #2
0
 /**
  * Creates the application.
  *
  * @return \KWApi\KWApi
  */
 public function createApplication()
 {
     $credential = new Credential($this->apiKey);
     $credential->setEndPoint($this->endPoint);
     return new KWApi($credential);
 }