2016-08-21 22:54:00 +02:00
|
|
|
<?php
|
|
|
|
include 'vendor/autoload.php';
|
|
|
|
|
2016-08-24 22:30:13 +02:00
|
|
|
define('APP_DIR', dirname(__FILE__));
|
|
|
|
define('DEALS_DIR', sprintf('%s/deals', APP_DIR));
|
|
|
|
|
|
|
|
$script_params = parse_ini_file(sprintf('%s/lbcreposter.ini.dev', DEALS_DIR), true);
|
2017-09-06 06:29:28 +02:00
|
|
|
$config = new \Shikiryu\LBCReposter\Config($script_params);
|
2017-09-29 16:01:01 +02:00
|
|
|
$account = new \Shikiryu\LBCReposter\Account($client, $config);
|
|
|
|
$deal = \Shikiryu\LBCReposter\Deal::fromJSON(sprintf('%s/deals/tmp/data.json', APP_DIR));
|
2016-08-21 22:54:00 +02:00
|
|
|
|
|
|
|
if ($account->connect()) {
|
|
|
|
// existing deals
|
|
|
|
$deals = $account->getDeals();
|
2016-08-24 22:30:13 +02:00
|
|
|
/** @var \Shikiryu\LBCReposter\Deal $deal */
|
|
|
|
foreach ($deals as $deal) {
|
|
|
|
$deal->save(DEALS_DIR);
|
|
|
|
}
|
2017-09-06 06:29:28 +02:00
|
|
|
|
|
|
|
$account->addDeal($deal);
|
|
|
|
|
2016-08-21 22:54:00 +02:00
|
|
|
var_dump($deals);
|
2017-09-29 16:01:01 +02:00
|
|
|
}
|