Skip to content

Commit

Permalink
Add missing inventory and outlet apis to the factory
Browse files Browse the repository at this point in the history
  • Loading branch information
szeber committed Jun 16, 2017
1 parent d1a3eb9 commit b2e9a72
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/ShoppinPal/Vend/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use ShoppinPal\Vend\Api\V0\Users as UsersV0;
use ShoppinPal\Vend\Api\V0\Webhooks as WebhooksV0;
use ShoppinPal\Vend\Api\V2\Customers as CustomersV2;
use ShoppinPal\Vend\Api\V2\Inventory as InventoryV2;
use ShoppinPal\Vend\Api\V2\Outlets as OutletsV2;
use ShoppinPal\Vend\Api\V2\PaymentTypes as PaymentTypesV2;
use ShoppinPal\Vend\Api\V2\PriceBooks as PriceBooksV2;
use ShoppinPal\Vend\Api\V2\Products as ProductsV2;
Expand Down Expand Up @@ -117,12 +119,33 @@ public function getCustomersApi($version)
}
}

/**
* Returns an Inventory API handler.
*
* @param string $version The version to use. {@uses self::API_VERSION_*}
*
* @return InventoryV2
*
* @throws ParameterException If the version is invalid.
* @throws \YapepBase\Exception\ConfigException If the required configuration params are not set.
*/
public function getInventoryApi($version)
{
switch ($version) {
case self::API_VERSION_2:
return new InventoryV2($this->getAuthHelper(), $this->getDomainPrefix());

default:
throw new ParameterException('Unknown version: ' . $version);
}
}

/**
* Returns an Outlets API handler.
*
* @param string $version The version to use. {@uses self::API_VERSION_*}
*
* @return OutletsV0
* @return OutletsV0|OutletsV2
*
* @throws ParameterException If the version is invalid.
* @throws \YapepBase\Exception\ConfigException If the required configuration params are not set.
Expand All @@ -133,6 +156,9 @@ public function getOutletsApi($version)
case self::API_VERSION_0:
return new OutletsV0($this->getAuthHelper(), $this->getDomainPrefix());

case self::API_VERSION_2:
return new OutletsV2($this->getAuthHelper(), $this->getDomainPrefix());

default:
throw new ParameterException('Unknown version: ' . $version);
}
Expand Down

0 comments on commit b2e9a72

Please sign in to comment.