/** * Get the singleton * * @return object */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new GiveItSdkClient(); } return self::$instance; }
public function verifyKeys() { $client = GiveItSdkClient::getInstance(); $authenticated = $client->authenticate(); if (!$authenticated) { $this->addError('unable to log in with private key'); return false; } $result = $client->sendGET('/retailers/me'); if (isset($result->errors)) { foreach ($result->errors as $error) { $this->addError($error); } return false; } // at this point we can assume that the private key is okay, verify the other two if ($result->public_api_key != $this->public_key) { $this->addError('incorrect public key'); return false; } if ($result->data_key != $this->data_key) { $this->addError('incorrect data key'); return false; } return true; }
public function setShipped() { $client = GiveItSdkClient::getInstance(); $data = array('status' => 'retailer_shipped'); $client->sendPUT("/sales/{$this->id}", $data); }
private function setupClient() { $this->client = GiveItSdkClient::getInstance(); }