Skip to content

Commit 807f719

Browse files
authored
Get picture URL large on FindingService calls (#80)
* eslint fixes * add output selector to get PictureURLLarge from ebay find call
1 parent 7332417 commit 807f719

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/buildURL.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const buildURL = {
2424
baseUrl += options.additionalParam ? '&' + options.additionalParam : '';
2525
baseUrl += options.sortOrder ? '&sortOrder=' + options.sortOrder : '';
2626
baseUrl += '&outputSelector(0)=SellerInfo';
27+
baseUrl += '&outputSelector(1)=PictureURLLarge';
2728
baseUrl += options.limit ? '&paginationInput.entriesPerPage=' + options.limit : '';
2829
baseUrl += options.globalID ? '&GLOBAL-ID=' + options.globalID : '';
2930
baseUrl += options.pageNumber ? '&paginationInput.pageNumber=' + options.pageNumber : '';

test/buildURL.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('test building url methods', () => {
77

88

99
it('test search url', () => {
10-
let expected_search_url = 'https://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=testID&OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&keywords=iphone&outputSelector(0)=SellerInfo&paginationInput.entriesPerPage=6&GLOBAL-ID=EBAY-US'
10+
let expected_search_url = 'https://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=testID&OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&keywords=iphone&outputSelector(0)=SellerInfo&outputSelector(1)=PictureURLLarge&paginationInput.entriesPerPage=6&GLOBAL-ID=EBAY-US';
1111
let options = {
1212
name: 'iphone',
1313
operationName: 'findItemsByKeywords',
@@ -16,32 +16,32 @@ describe('test building url methods', () => {
1616
limit: 6,
1717
globalID: 'EBAY-US',
1818
baseSvcUrl: 'svcs.ebay.com'
19-
}
19+
};
2020
expect(buildURL.buildSearchUrl(options)).to.be.equal(expected_search_url);
2121
});
2222

2323
it('test Shopping url without selector', () => {
24-
let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone'
24+
let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone';
2525
let options = {
2626
name: 'iphone',
2727
operationName: 'demoShoppingName',
2828
param: 'keywords',
2929
clientID: 'testID',
3030
baseUrl: 'open.api.ebay.com'
31-
}
31+
};
3232
expect(buildURL.buildShoppingUrl(options)).to.be.equal(expected_search_url);
3333
});
3434

3535
it('test Shopping url including selector', () => {
36-
let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone&IncludeSelector=true'
36+
let expected_search_url = 'https://open.api.ebay.com/Shopping?appid=testID&callname=demoShoppingName&version=967&siteid=0&responseencoding=JSON&keywords=iphone&IncludeSelector=true';
3737
let options = {
3838
name: 'iphone',
3939
operationName: 'demoShoppingName',
4040
param: 'keywords',
4141
clientID: 'testID',
4242
includeSelector: true,
4343
baseUrl: 'open.api.ebay.com'
44-
}
44+
};
4545
expect(buildURL.buildShoppingUrl(options)).to.be.equal(expected_search_url);
4646
});
4747
});

test/findingApi.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ describe('test ebay finding Api', () => {
1212
let ebay = new eBay({
1313
clientID: 'ClientId'
1414
});
15-
expect(() => { ebay.findItemsByCategory() }).to.throw('Category ID is null or invalid');
15+
expect(() => { ebay.findItemsByCategory(); }).to.throw('Category ID is null or invalid');
1616
});
1717

1818
it('test findCompletedItemswith required params', () => {
1919
let ebay = new eBay({
2020
clientID: 'ClientId'
2121
});
22-
expect(() => { ebay.findCompletedItems('') }).to.throw('Keyword or category ID are required.');
22+
expect(() => { ebay.findCompletedItems(''); }).to.throw('Keyword or category ID are required.');
2323
});
2424
});
2525

2626
describe('test constructAdditionalParams', () => {
2727
it('test constructAdditionalParams with required params', () => {
28-
let expected_param = 'keywords=iphone&categoryId=111&sortOrder=PricePlusShippingLowest'
28+
let expected_param = 'keywords=iphone&categoryId=111&sortOrder=PricePlusShippingLowest';
2929
const options = {
3030
keywords: 'iphone',
3131
categoryId: '111',
@@ -88,7 +88,7 @@ describe('test ebay finding Api', () => {
8888
let ebay = new eBay({
8989
clientID: 'ABCD'
9090
});
91-
nockFindingApi.get('/services/search/FindingService/v1?SECURITY-APPNAME=ABCD&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&paginationInput.entriesPerPage=2&keywords=ipad&itemFilter(0).name=ExpeditedShippingType&itemFilter(0).value=OneDayShipping&outputSelector(0)=SellerInfo&GLOBAL-ID=EBAY-US')
91+
nockFindingApi.get('/services/search/FindingService/v1?SECURITY-APPNAME=ABCD&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.0.0&RESPONSE-DATA-FORMAT=JSON&paginationInput.entriesPerPage=2&keywords=ipad&itemFilter(0).name=ExpeditedShippingType&itemFilter(0).value=OneDayShipping&outputSelector(0)=SellerInfo&outputSelector(1)=PictureURLLarge&GLOBAL-ID=EBAY-US')
9292
.reply(200, { "findItemsAdvancedResponse": [{ "ack": ["Success"] }] });
9393
return ebay.findItemsAdvanced({
9494
entriesPerPage: 2,
@@ -100,5 +100,5 @@ describe('test ebay finding Api', () => {
100100
console.log(error);
101101
});
102102
});
103-
})
103+
});
104104
});

0 commit comments

Comments
 (0)