Skip to content

Commit

Permalink
0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jul 2, 2017
1 parent 9f3c04e commit bf2259b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
6 changes: 4 additions & 2 deletions API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ abstract protected function accept();

/**
* 2017-07-02
* @used-by \Dfe\Dynamics365\API\R::metadata()
* @used-by \Dfe\Dynamics365\API\R::p()
* @param string $path
* @param string|null $method [optional]
* @param array(string => mixed) $p [optional]
* @param string|null $method [optional]
* @throws DFE
*/
final function __construct($path, $method = null, array $p = []) {
final function __construct($path, array $p = [], $method = null) {
$this->_path = $path;
$this->_c = new C;
$this->_c->setMethod($method = $method ?: C::GET);
Expand Down
11 changes: 9 additions & 2 deletions API/R.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ static function pricelevels() {return self::p(__FUNCTION__);}
* 2017-07-01 «productpricelevel EntityType»: https://msdn.microsoft.com/en-us/library/mt592996.aspx
* «Information about how to price a product in the specified price level,
* including pricing method, rounding option, and discount type based on a specified product unit.»
* @param string $priceLevelId [optional]
* @return array(string => mixed)
*/
static function productpricelevels() {return self::p(__FUNCTION__);}
static function productpricelevels($priceLevelId = null) {return self::p(__FUNCTION__, df_clean([
'$filter' => !$priceLevelId ? null : "_pricelevelid_value eq $priceLevelId"
]));}

/**
* 2017-07-01 «product EntityType»: https://msdn.microsoft.com/en-us/library/mt607876.aspx
Expand All @@ -92,8 +95,12 @@ static function service() {return self::p('');}
* @used-by accounts()
* @used-by service()
* @param string $path
* @param array(string => mixed) $p [optional]
* @param string|null $method [optional]
* @return array(string => mixed)
* @throws DFE
*/
static function p($path) {return array_map('df_ksort', (new J($path))->p()['value']);}
static function p($path, array $p = [], $method = null) {return array_map(
'df_ksort', (new J($path, $p, $method))->p()['value']
);}
}
10 changes: 5 additions & 5 deletions T/Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ function accounts() {$this->p();}
function invalid() {$this->p('dummy');}

/** 2017-04-23 */
function metadata() {xdebug_break(); echo R::metadata();}
function metadata() {echo R::metadata();}

/** 2017-07-01 */
function products() {echo df_dump(df_json_encode_pretty(array_filter(
R::products(), function(array $p) {return df_starts_with($p['name'], 'Stripe');}
)));}
function products() {$this->o(array_filter(R::products(), function(array $p) {return
df_starts_with($p['name'], 'Stripe')
;}));}

/** 2017-06-30 */
function service() {echo df_dump(df_json_encode_pretty(R::service()));}
function service() {$this->o((R::service()));}
}
9 changes: 5 additions & 4 deletions T/Price.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php
namespace Dfe\Dynamics365\T;
use \Dfe\Dynamics365\Settings\Products as S;
use Dfe\Dynamics365\API\R as R;
use Dfe\Dynamics365\Settings\Products as S;
// 2017-07-02
final class Price extends TestCase {
/** 2017-07-02 */
function t00() {}

/** @test 2017-07-01 */
/** 2017-07-01 */
function pricelevels() {$this->p();}

/** 2017-07-01 */
function productpricelevels() {$this->p();}
/** @test 2017-07-01 */
function productpricelevels() {$this->o(R::productpricelevels(S::s()->priceList()));}

/** 2017-07-02 */
function priceList() {echo S::s()->priceList();}
Expand Down
14 changes: 11 additions & 3 deletions T/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
* @see \Dfe\Dynamics365\T\Basic
*/
abstract class TestCase extends \Df\Core\TestCase {
/**
* 2017-07-03
* @used-by p()
* @used-by \Dfe\Dynamics365\T\Basic::products()
* @used-by \Dfe\Dynamics365\T\Basic::service()
* @used-by \Dfe\Dynamics365\T\Price::productpricelevels()
* @param array(string => mixed) $r
*/
final protected function o(array $r) {echo df_dump(df_json_encode_pretty($r));}

/**
* 2017-07-01
* @param string|null $f [optional]
*/
final protected function p($f = null) {echo df_dump(df_json_encode_pretty(call_user_func([
R::class, $f ?: df_caller_f()
])));}
final protected function p($f = null) {$this->o((call_user_func([R::class, $f ?: df_caller_f()])));}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/dynamics365"
,"version": "0.1.6"
,"version": "0.1.7"
,"description": "The «Microsoft Dynamics 365» extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/dynamics365"
Expand Down

0 comments on commit bf2259b

Please sign in to comment.