Skip to content

Commit 7a0e7c9

Browse files
authored
Merge pull request #31 from keepacom/feature/api_catchup
- catchup with java 1.71
2 parents a083f2f + eff5cf6 commit 7a0e7c9

12 files changed

Lines changed: 215 additions & 47 deletions

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
composer.phar
33
/vendor/
44
.phpunit*
5-
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
6-
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
7-
# composer.lock
5+
*.log
6+
*.phar
7+
*.txt

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ script:
1919
- phpunit -c phpunit.xml
2020
env:
2121
global:
22-
- secure: mcVBUZ4dyDjB2PmDgfUoyiIc3WH1NbpVVRTP+xoezbNnxGmOCKoMUqwAx87+pawJd/zLoyCCHsbCnZIKvSCgkBaBj8hMv3dkT645x/4prDRbrUftx4xfg/iU80VvwfrNIzpYs20ujyTbXM5cLTDat5CkR15Ey1WeOCXjscEfjWZrmFfYxg6gmDxDVfUS/E3M9b2rfiSUQ5mErNRoD2+olpXGBVCFfZVtUeWMcd7k8gmyBDws5gxueJcOmgP39AtmJBr/s3PKLvNbuEfKNnccieL0dgGVCWKgAYSBwQMHPN9j2My6E0kY99lvvAz8Z6ymD4PP7pLIYCk9xcNkDwmtKx68MMXxPhx9i9TygOJ82bw3w+Be6gA1l+ZHNwF7xM3U4ZGXiXTMFI41UBtYcvGxMQvrP2LZeHtB94+xl7nxxXMFnQusv7o0NBnpOAp8UY4L6kVwtVmcLXLdUGxEiKBtPhPE1dwhvm6G0uoyM9kNsi0brJgenOOmhVYbRLMX3DgZeRs9FBe5hRGQ+3Vqlzwsk11U7sMNeZoXcxLlrslUQfhW2861D0Hjf1o0y0hHwuDGldaaRFn1cMO/4RPj00+arFSU1PJooCHdUeqAj95Yr1/7iABidZeyX0cnyLgZflyBgihYOOlIib7NRTdYbF4HaHke32w9xkivVm3KBywsYsY=
22+
- secure: LGXc3k+Iy8nJbA+xllNk6FbGdb6i4tINU/gCfFlVIamVTQW4IGCfPajPBj5ulsr75YKPoeeya21zwr9nnq3nmBwCppVQHiWBBZDCnaFp8BTTyd6K3q8pJyjWikHJah2UvBUB+XbpzDv7a426tKha2rZWwnBnSnjxrRg0FRNkKvBbm6TvFPHrxNc6RPXpjk3AbRfKgWhFsPJodt4hEU2Pl01HC7eBSs9SgaP6cq5dnx078y4kJVGL10o4N0fGpMPrm7T+NKBukz0FxvqYW7U/Jxmzh+qBRNdx7KymRPBEPNi9ULW5tFFNMwICcmpVIoeoYPV04jNFT+X6A6cgc5jHivAnhKeDsldiGMKuCq24a43P3LmLpLaTs+CxYI/bw9izoSPPQuui2pBDuUwPlvJfqDRTDRGYGFdpEcTofjYkvz1D5tcNx3HkoTOBnXsdsV1pHKYgmlglnx30gBJLIw+sSd1T6Bpuub3qhw0932wfZf7MYwJBiJnS6kESWwmstCTVhZE5aaw/NCyXuS4PVvomxBkbJoh8jNpIKf47mLGPmB++/hGQhNjM9scMO/4EWcu+gqDgcSF8Erh3HyVcQ5WuCwukEZyq8FyaAcJLQucArOFb2IbCH02xIh/pJLQupr4WbJZdx3CqF9F4SMa8BxHlz3zlL598/6emLT6+Onx5Q20=

src/API/Request.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,57 @@ public static function getProductRequest($domainID, $offers, $statsStartDate, $s
264264
}
265265

266266

267+
/**
268+
* Retrieves the product for the specified ASIN and domain.
269+
* If our last update is older than 1 hour it will be automatically refreshed before delivered to you to ensure you get near to real-time pricing data.
270+
*
271+
* @param $domainID int Amazon locale of the product {@link AmazonLocale}
272+
* @param $offers int If specified (= not null) Determines the number of marketplace offers to retrieve. <b>Not available for Amazon China.</b>
273+
* @param $statsStartDate string Must ISO8601 coded date (with or without time in UTC). Example: 2015-12-31 or 2015-12-31T14:51Z. If specified (= not null) the product object will have a stats field with quick access to current prices, min/max prices and the weighted mean values in the interval specified statsStartDate to statsEndDate. .
274+
* @param $statsEndDate string the end of the stats interval. See statsStartDate.
275+
* @param $buybox bool If specified and true the product and statistics object will include all available buy box related data
276+
* @param $update int If the product's last refresh is older than <i>update</i>-hours force a refresh. Use this to speed up requests if up-to-date data is not required. Might cost an extra token if 0 (= live data). Default 1.
277+
* @param $history bool Whether or not to include the product's history data (csv field). If you do not evaluate the csv field set to false to speed up the request and reduce traffic.
278+
* @param $rental bool If true the rental price will be collected when available. <b>Can only be used in conjunction with the offers parameter. Not available for Amazon China.
279+
* @param $rating bool If true the product object will include our existing RATING and COUNT_REVIEWS history of the csv field, regardless if the offers parameter is used <b>Not available for Amazon China.
280+
* @param $fbafees bool If true fbaFees will be retrieved. <b>Can only be used in conjunction with the offers parameter. Not available for Amazon China, India and Brazil.
281+
* @param $onlyLiveOffers bool
282+
* @param $days int If specified and has positive value X the product object will limit all historical data to the recent X days.
283+
* @param $asins string[] ASINs to request, must contain between 1 and 100 ASINs - or max 20 ASINs if the offers parameter is used.
284+
* @param array $params Array of additional request parameters
285+
* @return Request ready to send request.
286+
*/
287+
public static function getDetailedProductRequest($domainID, $offers, $statsStartDate, $statsEndDate, $buybox, $update, $history, $rental, $rating, $fbafees, $onlyLiveOffers, $days, array $asins, $params = null)
288+
{
289+
$r = new Request();
290+
$r->path = "product";
291+
292+
if (!empty($asins))
293+
$r->parameter["asin"] = implode(",", $asins);
294+
295+
$r->parameter["domain"] = $domainID;
296+
$r->parameter["buybox"] = $buybox ? "1" : "0";
297+
$r->parameter["update"] = $update;
298+
$r->parameter["rental"] = $rental ? "1" : "0";
299+
$r->parameter["rating"] = $rating ? "1" : "0";
300+
$r->parameter["fbafees"] = $fbafees ? "1" : "0";
301+
$r->parameter["only-live-offers"] = $onlyLiveOffers ? "1" : "0";
302+
$r->parameter["history"] = $history ? "1" : "0";
303+
304+
if ($statsStartDate != null && $statsEndDate != null)
305+
$r->parameter["stats"] = $statsStartDate . "," . $statsEndDate;
306+
307+
if ($offers != null && $offers > 0)
308+
$r->parameter["offers"] = $offers;
309+
310+
if ($params) {
311+
foreach ($params as $key => $val) {
312+
$r->parameter[$key] = $val;
313+
}
314+
}
315+
return $r;
316+
}
317+
267318
/**
268319
* Add tracking to your list.
269320
*

src/KeepaAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class KeepaAPI
1717
private $userAgent = null;
1818
private $serializer = null;
1919
private $httpClient = null;
20-
private static $VERSION = "2.0.0";
20+
private static $VERSION = "2.0.1";
2121

2222
public function __construct($accessKey)
2323
{

src/helper/AvailabilityType.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ class AvailabilityType
99
{
1010
const NO_OFFER = -1;
1111
const NOW = 0;
12-
const FUTURE = 1;
12+
const PREORDERABLE = 1;
1313
const UNKNOWN = 2;
14-
const OTHER = 3;
14+
15+
/**
16+
* Amazon offer is currently not in stock but will be in the future - back-order
17+
*/
18+
const BACKORDERABLE = 3;
19+
20+
/**
21+
* Amazon offer availability is delay. Check availabilityAmazonDelay field for details.
22+
*/
23+
const DELAYED = 4;
1524

1625
public function __construct($i, $price, $deal, $shipping, $extra)
1726
{

src/helper/HazardousMaterialType.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/helper/RentalObject.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
namespace Keepa\helper;
3+
4+
/**
5+
* Contains Rental information.
6+
*/
7+
class RentalObject
8+
{
9+
/**
10+
* @var int
11+
*/
12+
public $initialPrice = -1;
13+
14+
/**
15+
* @var int
16+
*/
17+
public $shortExtnPrice = -1;
18+
19+
/**
20+
* @var int
21+
*/
22+
public $longExtnPrice = -1;
23+
24+
/**
25+
* @var int
26+
*/
27+
public $fullPrice = -1;
28+
}

src/objects/AmazonLocale.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ class AmazonLocale
1313
const FR = 4;
1414
const JP = 5;
1515
const CA = 6;
16-
const CN = 7;
16+
const RESERVED2 = 7;
1717
const IT = 8;
1818
const ES = 9;
1919
const IN = 10;
2020
const MX = 11;
21-
const BR = 12;
22-
const AU = 13;
2321
}

src/objects/Product.php

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ class Product
315315
public $lastEbayUpdate = 0;
316316

317317
/**
318-
* 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).
319-
* To request the Amazon availability in such cases the offers parameter is required.
318+
* Availability of the Amazon offer {@link Product.AvailabilityType}.
320319
* @var int
321320
*/
322321
public $availabilityAmazon = -1;
@@ -339,6 +338,43 @@ class Product
339338
*/
340339
public $salesRankReferenceHistory = null;
341340

341+
/**
342+
* If the product is listed in the launchpad
343+
* @var boolean|null
344+
*/
345+
public $launchpad = false;
346+
347+
/**
348+
* Rental details
349+
* @var string|null
350+
*/
351+
public $rentalDetails = false;
352+
353+
/**
354+
* Rental details
355+
* @var \Keepa\helper\RentalObject|null
356+
*/
357+
public $rentalPrices = false;
358+
359+
/**
360+
* Rental seller id
361+
* @var string|null
362+
*/
363+
public $rentalSellerId = null;
364+
365+
/**
366+
* Amazon offer shipping delay. Integer array with 2 entries, indicating min and max shipping delay in hours.
367+
* @var int[]|null
368+
*/
369+
public $availabilityAmazonDelay = null;
370+
371+
/**
372+
* Audience rating. The rating suggests the age for which the media is appropriate.
373+
* Example: PG-13 (Parents Strongly Cautioned)
374+
* @var string|null
375+
*/
376+
public $audienceRating = null;
377+
342378
/**
343379
* States the last time we have updated the product rating and review count, in Keepa Time minutes.<br>
344380
* Use {@link KeepaTime#keepaMinuteToUnixInMillis(int)} (long)} to get an uncompressed timestamp (Unix epoch time).

src/objects/Stats.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,18 @@ class Stats
250250
*/
251251
public $buyBoxMaxOrderQuantity = null;
252252

253-
/**
253+
/**
254254
* The availability message of the buy box. null if not available.
255255
* Example: “In Stock.”
256256
* @var string|null
257257
*/
258-
public $buyBoxAvailabilityMessage = null;
258+
public $buyBoxAvailabilityMessage = null;
259+
260+
/**
261+
* The seller id of the buy box offer, if existent. Otherwise "-2" or null
262+
* @var string|null
263+
*/
264+
public $buyBoxSellerId = null;
259265

260266
/**
261267
* The default shipping country of the buy box seller. null if not available. Example: “US”
@@ -329,4 +335,10 @@ class Stats
329335
* @var int|null
330336
*/
331337
public $salesRankDrops180 = -1;
338+
339+
/**
340+
* The count of sales rank drops (from high value to low value) within the last 365 days which are considered to indicate sales.
341+
* @var int|null
342+
*/
343+
public $salesRankDrops360 = -1;
332344
}

0 commit comments

Comments
 (0)