Added commodity-v1 publish function

This commit is contained in:
AnthorNet 2015-04-22 17:02:45 +02:00
parent 335af9ceb8
commit de78a388c0

View File

@ -7,6 +7,22 @@
* 'softwareVersion' => 'v3.14'
* ));
*
* $result = $eddn->publishCommodityV1(
* 'Eranin',
* 'Azeban Orbital',
* time(),
* array(
* "itemName" => "Gold",
* "buyPrice" => 1024,
* "supply" => 7,
* "stationStock" => "Low",
* "sellPrice" => 1138,
* "demand" => 42,
* "demandLevel" => "Med"
* )
* ); // return true;
*
*
* $result = $eddn->publishCommodityV2(
* 'Eranin',
* 'Azeban Orbital',
@ -75,6 +91,21 @@ class EDDN
throw new Exception('Option "softwareVersion" is required.');
}
public function publishCommodityV1($systemName, $stationName, $timestamp, array $commodity)
{
$schema = self::$_schemas['commodity-v1'][((self::$_debug === true) ? 'test' : 'production')];
$message = array();
$message['systemName'] = $systemName;
$message['stationName'] = $stationName;
$message['timestamp'] = date('c', $timestamp);
foreach($commodity AS $key => $value)
$message[$key] = $value;
return $this->_postToEDDN($schema, $message);
}
public function publishCommodityV2($systemName, $stationName, $timestamp, array $commodities)
{
$schema = self::$_schemas['commodity-v2'][((self::$_debug === true) ? 'test' : 'production')];