"Price Spectre"
 All Data Structures Functions Pages
Listing Class Reference

Public Member Functions

 getListingID ()
 
 getTitle ()
 
 getPrice ()
 
 getStartTime ()
 
 getStartDate ()
 
 getEndTime ()
 
 getEndDate ()
 
 getSeller ()
 
 getMerchantID ()
 
 getFeedbackScore ()
 
 getFeedbackPercent ()
 
 getFeedbackRating ()
 
 getFeedbackStar ()
 
 isTRS ()
 
 getReturnsAccepted ()
 
 getFreeShipping ()
 
 getOneDayShipping ()
 
 getConditionID ()
 
 getConditionName ()
 
 getSite ()
 
 getLocation ()
 
 getSecondsSinceStart ()
 
 getSecondsRemaining ()
 
 isDeleted ()
 

Detailed Description

A class that represents a competitor's listing.

Member Function Documentation

getConditionID ( )

Retrieves the numerical representation of the condition of the item.

Returns
If a condition is specified returns an integer as specified at http://developer.ebay.com/devzone/finding/callref/Enums/conditionIdList.html . Returns 0, otherwise.
// Delete all non-new listings
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
// Delete if not new
if(results[i].getConditionID() != 1000)
{
ps.delete(i);
}
}
getConditionName ( )

Retrieves the string representation of the condition of a listing, if available.

Returns
A string such as 'Brand New', 'Like New', 'New in Box', etc. This value is dependent on the category and site the item is listed to. See http://pages.ebay.com/sellerinformation/sellingresources/itemconditionlookup.html and http://developer.ebay.com/devzone/finding/callref/Enums/conditionIdList.html for example return values.
getEndDate ( )

Retrieves the end date of a competitor's listing.

Returns
The end date of the listing in format 'MMM DD' if listed on eBay. Returns an empty string, otherwise.
getEndTime ( )

Retrieves the number of seconds after 1970-01-01T00:00:00Z that the listing will end.

Returns
The epoch time representing when the listing will end if the listing was posted to eBay. Returns 2147483647, otherwise.
results = ps.getResults();
numResults = ps.getNumResults();
now = Math.round(Date.now() / 1000);
secondsPerDay = 86400;
// Delete all results that will end in less than one day.
for(i = 0; i < numResults; ++i)
{
end = results[i].getEndTime();
timeleft = end - now;
if(timeleft < secondsPerDay)
{
ps.delete(i);
}
}
getFeedbackPercent ( )

Retrieves the feedback percentage of the listing's seller.

Returns
For eBay and Half.com listings, a real number between 0 and 100 representing the feedback percentage of the listing's seller. Returns 0 for Amazon listings.
// Delete all listings that have an eBay feedback percent below 98% or Amazon rating below 4.8.
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
site = results[i].getSite();
percent = results[i].getFeedbackPercent();
rating = results[i].getFeedbackRating();
if(site == 'eBay' && percent < 98)
{
ps.delete(i);
}
else if(site == 'Amazon' && rating < 4.8)
{
ps.delete(i);
}
}
getFeedbackRating ( )

Retrieves the feedback rating of the listing's seller.

Returns
For eBay and Half.com listings, returns 0. For Amazon sellers returns a real number between 0 and 5 representing the seller's feedback rating.
// Delete all listings that have an eBay feedback percentage below 98% or Amazon rating below 4.8.
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
site = results[i].getSite();
percent = results[i].getFeedbackPercent();
rating = results[i].getFeedbackRating();
if(site == 'eBay' && percent < 98)
{
ps.delete(i);
}
else if(site == 'Amazon' && rating < 4.8)
{
ps.delete(i);
}
}
getFeedbackScore ( )

Retrieves the feedback score of the listing's seller.

Returns
An integer representing the net feedback score of the listing's seller.
// Delete all listings that have an Amazon feedback score below minFeedback or rating less than 4.8.
// By default the minFeedback filter only works on eBay/Half.com listings.
results = ps.getResults();
numResults = ps.getNumResults();
minFeedback = ps.getSearchParameter('minFeedback');
for(i = 0; i < numResults; ++i)
{
site = results[i].getSite();
rating = results[i].getFeedbackRating();
score = results[i].getFeedbackScore();
if(site == 'Amazon' && (rating < 4.8 || score < minFeedback))
{
ps.delete(i);
}
}
getFeedbackStar ( )

Retrieves a string representation of the feedback star of the seller.

Returns
If the listing is on eBay or Half.com returns a string representation such as 'none', 'yellow', or 'silverShooting'. Returns 'none' for all Amazon listings.
getFreeShipping ( )

Retrieves whether the listing offers free shipping.

Returns
If free shipping is offered return TRUE. Returns FALSE, otherwise.
// Delete all listings that don't offer free shipping
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
if(!results[i].getFreeShipping())
{
ps.delete(i);
}
}
getListingID ( )

Retrieves the item number or ASIN of a competitor's listing.

Returns
If the listing is found on eBay or Half.com, returns the 12 digit item number. If the listing was located on Amazon then return the ten character ASIN.
// Sets price first listing found that isn't specified by X.
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
if(results[i].getListingID() != x)
{
ps.setPrice(results[i].getPrice());
break;
}
}
getLocation ( )

Retrieves the country the item is located.

Returns
Two-letter ISO 3166 country code to indicate the country where the item is located (e.g., "US" for the United States or "GB" for the United Kingdom).
results = ps.getResults();
numResults = ps.getNumResults();
// Delete all results that are not located in the US or Canada.
for(i = 0; i < numResults; ++i)
{
country = results[i].getLocation();
if(country != 'US' && country != 'CA')
{
ps.delete(i);
}
}
getMerchantID ( )

Retrieves the merchant ID of the listing's seller.

Returns
For Amazon listings returns the Amazon merchant ID of the listing's seller. Otherwise returns an empty string.
getOneDayShipping ( )

Retrieves whether the listing offers one day shipping.

Returns
If one day shipping is available return TRUE. Returns FALSE, otherwise.
// Delete all listings that don't offer one day shipping
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
if(!results[i].getOneDayShipping())
{
ps.delete(i);
}
}
getPrice ( )

Retrieves the total price of a competitor's listing.

Returns
The total price of the competitor's listing.
// Matches the price of the lowest found listing.
results = ps.getResults();
numResults = ps.getNumResults();
if(numResults > 0)
ps.setPrice(results[0].getPrice());
getReturnsAccepted ( )

Retrieves whether the listing allows for returns.

Returns
If returns are accepted return TRUE. Returns FALSE, otherwise.
// Delete all listings that allow returns.
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
if(results[i].getReturnsAccepted())
{
ps.delete(i);
}
}
getSecondsRemaining ( )

Retrieves the number of seconds before the listing will end.

Returns
The number of seconds that before the listing will end if it was listed on eBay. Returns 2147483647, otherwise.
results = ps.getResults();
numResults = ps.getNumResults();
secondsPerDay = 86400;
// Delete all results that will end in less than one day.
for(i = 0; i < numResults; ++i)
{
timeleft = results[i].getSecondsRemaining();
if(timeleft < secondsPerDay)
{
ps.delete(i);
}
}
getSecondsSinceStart ( )

Retrieves the number of seconds since the listing has started.

Returns
The number of seconds that have elapsed since the listing started if it was listed on eBay. Otherwise, returns 0.
results = ps.getResults();
numResults = ps.getNumResults();
secondsPerDay = 86400;
// Delete all results that have been listed less than one day.
for(i = 0; i < numResults; ++i)
{
age = results[i].getSecondsSinceStart();
if(age < secondsPerDay)
{
ps.delete(i);
}
}
getSeller ( )

Retrieves the seller ID of the listing's seller.

Returns
A string containing the userid of the listing's seller.
getSite ( )

Retrieves the site the listing is from.

Returns
The string 'eBay' if the item is listed on eBay. The string 'Half' if the item is listed on Half.com. The string 'Amazon' if the item is listed on Amazon.
getStartDate ( )

Retrieves the start date of a competitor's listing.

Returns
The start date of the listing in format 'MMM DD' if listed on eBay. Returns an empty string, otherwise.
getStartTime ( )

Retrieves the number of seconds after 1970-01-01T00:00:00Z that the listing was listed.

Returns
The epoch time representing when the listing was first listed if the listing was posted to eBay. Returns 0, otherwise.
results = ps.getResults();
numResults = ps.getNumResults();
now = Math.round(Date.now() / 1000);
secondsPerDay = 86400;
// Delete all results that have been listed less than one day.
for(i = 0; i < numResults; ++i)
{
start = results[i].getStartTime();
age = now - start;
if(age < secondsPerDay)
{
ps.delete(i);
}
}
getTitle ( )

Retrieves the title of a competitor's listing.

Returns
The title of listing.
results = ps.getResults();
numResults = ps.getNumResults();
// Delete all results containing the word 'parts'
// Note: this should be done using the keyword "-parts" instead.
for(i = 0; i < numResults; ++i)
{
title = results[i].getTitle();
if(title.indexOf('parts') != -1)
{
ps.delete(i);
}
}
isDeleted ( )

Retrieves whether the listing has been deleted or not.

Returns
TRUE if the listing has been deleted. Otherwise, returns FALSE.
// Delete all non-new listings
results = ps.getResults();
numResults = ps.getNumResults();
for(i = 0; i < numResults; ++i)
{
// Delete if not new
if(results[i].getConditionID() != 1000)
{
ps.delete(i);
}
}
// Perform X lowest by $Y on remaining listings.
count = 0;
for(i = 0; i < numResults; ++i)
{
// skip if this is a deleted listing.
if(results[i].isDeleted())
continue;
// if this is the listing to match against
count++;
if(count >= x)
{
ps.setPrice(results[i].getPrice() - y);
break;
}
}
isTRS ( )

Retrieves whether or not the listing is from a Top Rated Seller.

Returns
If the listing is on eBay or Half.com and the seller is a Top Rated Seller then return TRUE. Returns FALSE, otherwise.