Skip to content

Commit

Permalink
- catchup with java 1.61
Browse files Browse the repository at this point in the history
  • Loading branch information
saschaarthur committed Jun 4, 2020
1 parent 7c93d69 commit 4b437f0
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 96 deletions.
6 changes: 6 additions & 0 deletions src/objects/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ final class Category
*/
public $name;

/**
* The context free category name.
* @var string|null
*/
public $contextFreeName;

/**
* List of all sub categories. null or [] (empty array) if the category has no sub categories.
* @var int[]|null
Expand Down
84 changes: 21 additions & 63 deletions src/objects/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,6 @@ class Product
*/
public $variationCSV = null;

/**
* @deprecated use first upcList entry instead.
* The UPC of the product. Caution: leading zeros are truncated.
* @var string
*/
public $upc = 0;

/**
* @deprecated use first eanList entry instead.
* The EAN of the product. Caution: leading zeros are truncated.
* @var string
*/
public $ean = 0;

/**
* The manufacturer’s part number.
* @var string|null
*/
public $mpn = null;

/**
* Comma separated list of image names of the product. Full Amazon image path:<br>
* https://images-na.ssl-images-amazon.com/images/I/_image name_
Expand Down Expand Up @@ -106,24 +86,6 @@ class Product
*/
public $brand = null;

/**
* The item's label. null if not available.
* @var string|null
*/
public $label = null;

/**
* The item's department. null if not available.
* @var string|null
*/
public $department = null;

/**
* The item's publisher. null if not available.
* @var string|null
*/
public $publisher = null;

/**
* The item's productGroup. null if not available.
* @var string|null
Expand All @@ -136,18 +98,6 @@ class Product
*/
public $partNumber = null;

/**
* The item's studio. null if not available.
* @var string|null
*/
public $studio = null;

/**
* The item's genre. null if not available.
* @var string|null
*/
public $genre = null;

/**
* The item's model. null if not available.
* @var string|null
Expand All @@ -172,12 +122,6 @@ class Product
*/
public $edition = null;

/**
* The item's platform. null if not available.
* @var string|null
*/
public $platform = null;

/**
* The item's format. null if not available.
* @var string|null
Expand Down Expand Up @@ -266,12 +210,6 @@ class Product
*/
public $description = null;

/**
* The item's format. null if not available.
* @var int|null
*/
public $hazardousMaterialType = null;

/**
* The package's height in millimeter. 0 or -1 if not available.
* @var int
Expand Down Expand Up @@ -377,11 +315,31 @@ class Product
public $lastEbayUpdate = 0;

/**
* Availability of the Amazon offer {@link Product.AvailabilityType}.
* Availability of the Amazon offer {@link Product.AvailabilityType}. If Amazon offer exists but does not hold the buy box the value will be 2 (unknown).
* To request the Amazon availability in such cases the offers parameter is required.
* @var int
*/
public $availabilityAmazon = -1;

/**
* Contains subcategory rank histories. Each key represents the categoryId of the rank with the history in the corresponding value.
* @var array|null
*/
public $salesRanks = null;

/**
* The category node id of the main sales rank. -1 if not available.
* @var int
*/
public $salesRankReference = -1;

/**
* The category node id history of the main sales rank (format: timestamp, categoryId, […]). null if not available.
* @var int[]
*/
public $salesRankReferenceHistory = null;


/**
* States the last time we have updated the product rating and review count, in Keepa Time minutes.<br>
* Use {@link KeepaTime#keepaMinuteToUnixInMillis(int)} (long)} to get an uncompressed timestamp (Unix epoch time).
Expand Down
44 changes: 44 additions & 0 deletions src/objects/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,50 @@ class Stats
*/
public $buyBoxIsMAP = null;

/**
* The minimum order quantity of the buy box. -1 if not available, 0 if no limit exists.
* @var bool|null
*/
public $buyBoxMinOrderQuantity = null;

/**
* The maximum order quantity of the buy box. -1 if not available, 0 if no limit exists.
* @var bool|null
*/
public $buyBoxMaxOrderQuantity = null;

/**
* The availability message of the buy box. null if not available.
* Example: “In Stock.”
* @var string|null
*/
public $buyBoxAvailabilityMessage = null;

/**
* The default shipping country of the buy box seller. null if not available. Example: “US”
* @var string|null
*/
public $buyBoxShippingCountry = null;

/**
* If the buy box is Prime exclusive. null if not available.
* @var bool|null
*/
public $buyBoxIsPrimeExclusive = null;

/**
* If the buy box is Prime eligible. null if not available.
* @var bool|null
*/
public $buyBoxIsPrimeEligible = null;

/**
* If the buy box is a Prime Pantry offer. null if not available.
* @var bool|null
*/
public $buyBoxIsPrimePantry = null;


/**
* Only set when the offers parameter was used. If the product is an add-on item (add-on Items ship with orders that include $25 or more of items shipped by Amazon).
* @var bool|null
Expand Down
52 changes: 19 additions & 33 deletions src/tests/ProductRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,6 @@ public function testFeatures()
self::assertGreaterThan(0, count($response->products[0]->features));
}

/**
* @throws \Exception
*/
public function testHazardousMaterialType()
{
$request = Request::getProductRequest(AmazonLocale::US, 0, null, null, 0, true, ['B00EAN1APM']);

$response = $this->api->sendRequestWithRetry($request);
self::assertEquals($response->status, "OK");
self::assertNotNull($response->products[0]->hazardousMaterialType);
self::assertEquals(HazardousMaterialType::ORM_D_Class, $response->products[0]->hazardousMaterialType);
}

/**
* @throws \Exception
*/
Expand All @@ -201,26 +188,6 @@ public function testMap()
self::assertNotNull($response->products[0]->newPriceIsMAP);
}

/**
* @throws \Exception
*/
public function testPromotions()
{
$request = Request::getProductRequest(AmazonLocale::US, 0, null, null, 0, true, ['B006XISCNA']);

$response = $this->api->sendRequestWithRetry($request);
self::assertEquals($response->status, "OK");
self::assertEquals(1, count($response->products));
self::assertNotNull($response->products);
self::assertGreaterThan(0, count($response->products));
self::assertNotNull($response->products[0]->promotions);
self::assertGreaterThan(0, count($response->products[0]->promotions));
self::assertNotNull($response->products[0]->promotions[0]->benefitDescription);
self::assertNotNull($response->products[0]->promotions[0]->eligibilityRequirementDescription);
self::assertNotNull($response->products[0]->promotions[0]->promotionId);
self::assertNotNull($response->products[0]->promotions[0]->type);
}


/**
* @throws \Exception
Expand Down Expand Up @@ -468,4 +435,23 @@ public function testItemDimensions()
self::assertGreaterThan(0, $response->products[0]->itemLength);
self::assertGreaterThan(0, $response->products[0]->itemWeight);
}


/**
* @throws \Exception
*/
public function testSalesRanks()
{
$request = Request::getProductRequest(AmazonLocale::DE, 20, null, null, 0, true, ['B07HB4TJH1']);

$response = $this->api->sendRequestWithRetry($request);
self::assertEquals($response->status, "OK");
self::assertEquals(1, count($response->products));
self::assertNotNull($response->products[0]->salesRanks);
foreach($response->products[0]->salesRanks as $caId => $historie)
{
self::assertGreaterThan(0, $caId);
self::assertGreaterThan(0, count($historie));
}
}
}

0 comments on commit 4b437f0

Please sign in to comment.