Skip to content

Commit

Permalink
Renamed sdk structure and added back ability to ship and receive enti…
Browse files Browse the repository at this point in the history
…re purchase order
  • Loading branch information
brightantwiboasiako committed Aug 19, 2020
1 parent fcae9f4 commit 60133cb
Show file tree
Hide file tree
Showing 81 changed files with 613 additions and 511 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<directory>tests/SchemaTest.php</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/PurchaseOrdersTest.php</directory>
<directory suffix="Test.php">./tests/SuppliersTest.php</directory>
</testsuite>
</testsuites>
</phpunit>
35 changes: 35 additions & 0 deletions src/DataType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Skuio\Sdk;

use Skuio\Sdk\Support\Arrayable;
use Skuio\Sdk\Support\Jsonable;


/**
* Class DataType
* @package Skuio\Sdk
*
* @property int|null id
*/
abstract class DataType
{

use Arrayable, Jsonable;

/**
* Operations
*/
// for array of objects
const OPERATION_ADD = 'updateOrCreate';
const OPERATION_REPLACE = 'updateOrCreate';
const OPERATION_DELETE = 'delete';

public function __construct( array $attributes = null )
{
foreach ( $attributes ?: [] as $key => $value )
{
$this->$key = $value;
}
}
}
9 changes: 5 additions & 4 deletions src/Model/Address.php → src/DataType/Address.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Address
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $company
* @property string $name
* @property string $email
Expand All @@ -25,7 +26,7 @@
* @property string $country_code
* @property string $label
*/
class Address extends Model
class Address extends DataType
{

}
8 changes: 4 additions & 4 deletions src/Model/Attribute.php → src/DataType/Attribute.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use InvalidArgumentException;
use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Attribute
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $name
Expand All @@ -20,7 +20,7 @@
* @property bool $has_options
* @property int $sort_order
*/
class Attribute extends Model
class Attribute extends DataType
{
/**
* Attribute types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Attribute
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $name
* @property int|null $parent_id
* @property int[]|null $attributes
*/
class AttributeGroup extends Model
class AttributeGroup extends DataType
{
/**
* Set/Add attributes by id
Expand Down
19 changes: 19 additions & 0 deletions src/DataType/AttributeValue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Skuio\Sdk\DataType;

use Skuio\Sdk\DataType;

/**
* Class Address
*
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $value
* @property int $sort_order
*/
class AttributeValue extends DataType
{

}
8 changes: 4 additions & 4 deletions src/Model/Currency.php → src/DataType/Currency.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Currency
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $code
* @property string $name
* @property float $conversion
* @property bool $is_default
*/
class Currency extends Model
class Currency extends DataType
{
}
9 changes: 4 additions & 5 deletions src/Model/Customer.php → src/DataType/Customer.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Carbon\Carbon;
use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Customer
*
* @package App\Model
* @package App\DataType
*
* @property int $id
* @property int $default_address_id
Expand All @@ -17,7 +16,7 @@
* @property string|null $zip
* @property string|null address1
*/
class Customer extends Model
class Customer extends DataType
{

}
8 changes: 4 additions & 4 deletions src/Model/Import.php → src/DataType/Import.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class ImportProducts
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property string $csv_file
* @property string $csv_delimiter
* @property string $csv_enclosure
* @property bool $override - Override a product if exists?. Default value is 1.
*/
class Import extends Model
class Import extends DataType
{
public function __set( $name, $value )
{
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Incoterm.php → src/DataType/Incoterm.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Incoterm
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $code
* @property string $description
*/
class Incoterm extends Model
class Incoterm extends DataType
{
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class InventoryAdjustment
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $adjustment_date
* @property int $product_id
* @property int $warehouse_id
* @property int $warehouse_location_id
* @property float $quantity
* @property string $notes
*/
class InventoryAdjustment extends Model
class InventoryAdjustment extends DataType
{
}
8 changes: 4 additions & 4 deletions src/Model/NominalCode.php → src/DataType/NominalCode.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use InvalidArgumentException;
use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class NominalCode
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $code
* @property string $name
* @property string $type
*/
class NominalCode extends Model
class NominalCode extends DataType
{
/**
* Nominal Code types
Expand Down
8 changes: 4 additions & 4 deletions src/Model/PricingTier.php → src/DataType/PricingTier.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class ProductPricingTier
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $name
* @property string $currency_code
*/
class PricingTier extends Model
class PricingTier extends DataType
{

}
8 changes: 4 additions & 4 deletions src/Model/Product.php → src/DataType/Product.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Skuio\Sdk\Model;
namespace Skuio\Sdk\DataType;

use InvalidArgumentException;
use Skuio\Sdk\Model;
use Skuio\Sdk\DataType;

/**
* Class Product
*
* @package Skuio\Sdk\Model
* @package Skuio\Sdk\DataType
*
* @property int $id - sku.io id
* @property int $parent_id - parent sku.io id
Expand Down Expand Up @@ -49,7 +49,7 @@
*
* @property Product[] $variations
*/
class Product extends Model
class Product extends DataType
{
// for arrays
const OPERATION_SET = 'set';
Expand Down
18 changes: 18 additions & 0 deletions src/DataType/ProductAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Skuio\Sdk\DataType;

use Skuio\Sdk\DataType;

/**
* Class Attribute
*
* @package Skuio\Sdk\DataType
*
* @property int $id
* @property string $name
* @property mixed $value
*/
class ProductAttribute extends DataType
{
}
Loading

0 comments on commit 60133cb

Please sign in to comment.