/**
  * @return ShipwireConnector
  * @throws \Exception
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
         self::$instance->getClient();
     }
     return self::$instance;
 }
示例#2
0
<?php

require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php';
use flydreamers\shipwire\ShipwireConnector;
$config = ['username' => '*****@*****.**', 'password' => 'xxxxxxxxxxxxxx'];
$configFilePath = dirname(dirname(__DIR__)) . '/local-config.php';
if (file_exists($configFilePath)) {
    $config = array_merge($config, require_once $configFilePath);
}
ShipwireConnector::init($config['username'], $config['password'], 'sandbox');
 /**
  * @param string $route
  * @param array $params
  * @param string $body
  * @param bool $onlyResource
  * @return array
  * @throws \Exception
  * @throws \flydreamers\shipwire\exceptions\InvalidAuthorizationException
  * @throws \flydreamers\shipwire\exceptions\InvalidRequestException
  * @throws \flydreamers\shipwire\exceptions\ShipwireConnectionException
  */
 protected function put($route, $params, $body, $onlyResource = true)
 {
     return $this->_connector->api($route, $params, ShipwireConnector::PUT, $body, $onlyResource);
 }