ePages 7.1.0 - DE_EPAGES/Shop/API/Resource/ShopRequestContext.pm

Package DE_EPAGES::Shop::API::Resource::ShopRequestContext

helper class for shop-dependend REST resources.

Functions

apiBaseUrl
imageBaseUrl
new
shop
validCurrency
validLocale

apiBaseUrl

Returns the base URL for the REST API of the shop.

Syntax
$BaseURL = $ShopRequestContext->apiBaseUrl;
Return
$BaseURL (string)
REST API base URL, e.g. 'https://shop-domain'

imageBaseUrl

Returns the base URL for images of the shop.

Syntax
$BaseURL = $ShopRequestContext->imageBaseUrl;
Return
$BaseURL (string)
REST API base URL, e.g. 'https://shop-domain'

new

Create a new ShopRequestContext object for a given shop.

Syntax
$ShopRequestContext = $DE_EPAGES::Shop::API::Resource::ShopRequestContext->new($Shop);
Input
$Shop (DE_EPAGET::Shop::API::Object::Shop)
shop object
Return
$ShopRequestContext (DE_EPAGES::Shop::API::Resource::ShopRequestContext)
request context

shop

Returns the shop.

Syntax
$Shop = $ShopRequestContext->shop;
Return
$Shop (DE_EPAGET::Shop::API::Object::Shop)
shop of the current request

validCurrency

Returns the default shop locale if $RequestCurrencyID is undefined. Returns $RequestCurrencyID if the currency is supported by the shop. Throws a BadRequest error if the currency is not supported by the shop.

Syntax
$CurrencyID = $ShopRequestContext->validCurrency($RequestCurrencyID);
Input
$RequestCurrencyID (string)
currency id, e.g. 'EUR'
Return
$CurrencyID (string)
currency id, e.g. 'EUR'

validLocale

Returns the default shop locale if $RequestLocaleID is undefined. Returns $RequestLocaleID if the locale is supported by the shop. Throws a BadRequest error if the locale is not supported by the shop.

Syntax
$LocaleID = $ShopRequestContext->validLocale($RequestLocaleID);
Input
$RequestLocaleID (string)
locale id, e.g. 'de_DE'
Return
$LocaleID (string)
locale id, e.g. 'de_DE'